I’m trying to determine how exactly to calculate the rotation (in Unreal Engine 5, btw if that matters, but in C++ not Blueprints) needed for an object’s child to line up with some other object’s child…basically like a jigsaw piece.
I’ve attached an image to help demonstrate the problem.
Technically I’m calling them sockets and knobs. Sockets, like on the left larger cube, have an array of what knobs can attach, the local position, and the local rotation (in Euler angles). The knobs have a type (to check if they can attach), a local position and local rotation same as the sockets.
Assuming I’ve already determined which knob and which socket I want to ‘attach’, how do I calculate that rotation of the smaller cube from the diagram? The rotation of these objects in the world can be anything, and the euler angles, though likely to be clean 90-degree angles, could also be anything.
Thanks for the help!
-Matt