Dungeon generator: Alignment of static rooms

Godot Version

4.2.1.stable.official[b09f793f5]

Question: How to rotate and reposition multiple groups of meshes to specific “room exits” ?

Hi everyone ! I want to implement a dungeon generator into my game with static rooms that get mixed together. I am following this guide: Bake Your Own 3D Dungeons With Procedural Recipes | Envato Tuts+

My rooms consists of MeshInstances as Tiles of the same size and a Node3Ds as parents. Now I want to align them together randomly. In the guide they are using Position Markers on the exits. Is there an equal way I could do this in Godot ? I am struggling to find a way to have those Exit Markers in my Rooms and even perfectly aligned … also do I rotate each MeshInstance on its own or only the Parent Node3D e.g. “RoomTemplate” (Screenshot) ? (Also for putting together my meshes I use a specific snap addon “Snappy”)

How it is visualized in the Guide:
modules-all-600px

animation-modulematching-600px

My solution was to do some vector math. Substracting the two origin vectors of the Rooms and applying it to one room so the rooms will have the same origin and then substracting the Vectors of some two exit vectors of each room. Then substracting this difference from the room I want to move. The Exits are like the floor tiles placed and so I add or substract the aabb.size (add/sub and x or z depending on north/south or west/east) * 2 to the previously mentioned vector difference so that the tiles wont overlap.

1 Like

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