I have been working all day to try and implement a terrain chunk system. This way I can reload parts of the terrain instead of reloading the entire thing. The problem is that for some reason the copy and pasting of the regions isnt working.

I am starting to think that maybe you cant store terrainregions in tables and maybe this is the problem but I dont think so. The code doesnt error or anything so I am extremely lost as to the problem.

Heres a gif and some code.

I visualized the chunks here so you can see my region3s are correct https://gyazo.com/c56d529890ca1eeab71bf7e1d51eeec2

I figured out its my math to determine if a part is inside that is giving me trouble. It still prints 1 but it doesnt reload the terrain.

		local RelativePosition = Object[2].CFrame:PointToObjectSpace(GrabbedChestPosition)
		if math.abs(RelativePosition.X) <= Object[2].Size.X / 2 and math.abs(RelativePosition.Y) <= Object[2].Size.Y / 2 and math.abs(RelativePosition.Z) <= Object[2].Size.Z / 2 then			
			print(1)
			workspace.Terrain:PasteRegion(Object[3], Object[1].Min, true)
		end

Thanks and hopefully we can solve this!

4 comments

0

Can you try to make this more organized for others to understand? This seems complicated.

0

In what way? Like less crowded or??

0

Regions over 512x512x512 in size won’t copy or paste.

0

Its less than that, but I have narrowed the problem down and I will update the code to only show the line thats givig me the problem.