I just tried that and the module no longer matches up correctly. They still only rotate correctly when the attachment point rotations are different and not exactly the opposite. When they are exactly opposite, the module just rotates around and faces the direction the other attachment point is facing (the attachment point on the module that the new module is trying to connect to).
first invert the TA1 translation, then apply the TA1 rotation, afterwards the Ta2 transformation and eventually the TM2 transformation (in this order). Ensure that GetComponentLocation() delivers the (local) transformation relative to the module and not the location in worldspace. So your code looks correct at first glance.
When your objects (module/attachment) are in relation, then check if you can access the local/relative transformation. If you only have the worldspace transformation, then you can get the local transformation by doing this
I am having one problem though. When trying to connect two modules whose rotations are the exact opposite of each other, 'Tm1' ends up equaling 'Tm2'. This is very odd. It only does this on modules with exactly opposite rotations. For example:
Attaching Module 2 Attachment Point 2 (Yaw = -90) to Module 1 Attachment Point 1 (Yaw = 0) does this:
Attaching Module 2 Attachment Point 3 (Yaw = -180) to Module 1 Attachment Point 1 (Yaw = 0) does this:
What Attaching Module 2 Attachment Point 3 (Yaw = -180) to Module 1 Attachment Point 1 (Yaw = 0) should result in:
Hello Ashaman! Thanks for the response. Please forgive me but I thought I wrote the new code correctly but I am a little confused as to how this would translate into C++. My transformation code now looks like this: