Problem with aligning two rooms by surface

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By NullPointer

Hi I’m struggle with the movement/rotations.
I need to align two rooms by doors but im not able to solve the problem

func connectRoomByDoors(doorA, doorB):
var roomA = doorA.get_parent()
var roomB = doorB.get_parent()

var correctiveTranslation = doorA.transform.origin - doorB.transform.origin;
roomB.transform.origin = correctiveTranslation
# need to ratate roomB at axis of doorB pos to allign to doorB

I guess i need to use roomB.transform = roomB.transform.looking_at( doorB.transform.origin) to rotate the roomB to align to doorA?

I need to implement like this Bake Your Own 3D Dungeons With Procedural Recipes | Envato Tuts+