Hello everyone! I am working on a code to procedurally generate hallways as the player walks. I have that aspect of the code working. What I am having trouble with is that sometimes I need the spawned mesh to be rotated + or - 90 degrees on the Z Axis to connect with the hallway that spawned it. Pictures are provided below but the breakdown is this: I have 3 hallways (H1-H3) and 1 room (R1). if H1 spawns H2 or H3, they are fine and can be left alone. But if H1 spawns R1 this room has to be rotated 90 degrees on the Z Axis. Here is the code and how each hallway is set up:
So each room uses a collision box to spawn the next room when the player walks through it. The next room to spawn shows up with its Default Scene Root overlapping the LocSphere asset at the exit of the room.
This is the BP that spawns new rooms. It chooses one of the other rooms randomly via the Selection node and spawns it on the LocSphere. What I’m having trouble with is how to target a specific BP to rotate as needed. My idea was to use the following function, and hook it to a Branch at the end of the above BP to tell the engine “hey if R1 is spawned off of an H1, it needs to be rotated 90 degrees”:
When I put that plan into action, however, my H1 deleted itself from the world and R1 remained unrotated. Any ideas for what to do here?