3D Section Generation Bug

I have a section generator that works like doors.

function generateRoom()
    recentroom = maps.Forest:GetChildren()[math.random(1,#maps.Forest:GetChildren())]:Clone()
    recentroom.Parent = rooms
    recentroom.Parent = workspace
    recentroom:MoveTo(Vector3.new(lastroom.NextRoomAnchor.Position.X,0,lastroom.NextRoomAnchor.Position.Z))

    local boundingbox = lastroom:GetBoundingBox()
    print(boundingbox)
    local rotation = CFrame.Angles(0, math.rad(90), 0)
    local modelCFrame = recentroom:GetPivot()
    lastroom = recentroom  
end)

My issue is that the sections layer up and stack up for no reason on eachother




The terrain randomly breaks like this and it looks weird. I’ve tried my hardest to fix this and it doesn’t work for me. If anyone knows how to fix a generation system or give me a better idea on how to make a new system, please suggest them.

Are you using MoveTo to move it to the specified location without any obstructions?
MoveTo will keep moving the model up until it is no longer obstructed.
Give PivotTo a shot instead if that is not what you are intending to do

1 Like

Ill try this, thanks for the suggestion. Ill update you if it works or fails.

Thank you so much! It worked! I feel dumb for not figuring this out but thank you very much.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.