Hey friends I’m currently having trouble lining up procedurally generated rooms that I made in Blender. As of right now, I can line up the door position of the previous room to the door position of the new room, but I cannot for the life of me rotate the new room to match the old room’s orientation.
Each door has an Node3d labeled attach point which is used to determine the rotation and position of the door. Each “buiding_block” or room has an attach point that is set to Vector(0,0,0) with a rotation of Vector3(0, 180, 0).
I tried setting the new room’s rotation equal to the attach point that I wanted to attach to the old room using:
Only looked at your code briefly (sleep is calling me) but are you missing the rotation difference?
To rotate the new room so that its attach point lines up with the attach point from the previous room, wouldn’t you need to calculate the difference between their orientations and then apply that to the instance?
If your only copying over the global rotation like this:
it’ll work when either the instance or the attach point is 90/-90 degrees, but when both the instance, and attachpoint is 180/-180 or 0 degrees it will overlap the previous room like so:
The most painful part is that I’ve done this before, just in unity, so that knowledge doesn’t really apply very well here I’ll have another look if you or someone else hasn’t figured it out by the time I wake up tomorrow, and see if I can’t help a little more.
That seemed to give the instance some really weird rotations. Sorry, I came from Unreal Engine, so I’m having a hard time wrapping my head around all these new concepts that come packaged with unreal lmao. Thanks for helping me find new methods though.
Okay, I figured it out. The problem was finding the inverse of 0, and 180 the instance wouldn’t invert itself by multiplying it by a -1 value so we would need to calculate the difference of the two points and add 180 by it to ensure both 0, and 180 would be inverted.