Download

Attach actor by socket to another actor by socket? Align sockets?

Hello,

with AttachToComponent

Unbenannt.jpg

I can snap** the pivot point **of a target component to another component’s socket transform. How to snap a **socket transform **of a target component to a **socket transform **of a parent component? Both sockets should have the same world transform (same location, same rotation, same scale) after that.

Thank you,

Thilo

Hi man,
You have to create an abstracct “offset” something that create the difference you need.

For example
Lets say you have 2 planes, both with a “Socket” in a random place, that is not in the midde of the plane and not on the pivot.
One upper left, one upperight.
And you want to placce the two socket in the same place.

You have to get the difference between the “pivoot” and the “Socket” ,
Now Make a scene component in your plane, mmake the plane child of the scene comp.

Now if you attach the actor to the socket you just place the middle of the plane A, on the Socket of Plane B
What remain to add is the difference you calculated before,
So add a local position to the Scene component, based on the think we calculated before.

And here you should have the 2 planes with sockets in the same place

This is basically what I tried to get to work for two days. It didn’t work. Something is not okay with “rotational differences”… Maybe it’s inaccuracy, or something with Euler rotations or Quaternions… I don’t know. What in the end worked is this:

Rotating the target component to the world coordinate system by applying the inverse of the socket’s rotation (InvertRotator, so the rotation of the socket is (0,0,0)) and then rotating it to the parent’s socket rotation (CombineRotators). I thought you can make this in one step by calculating the delta rotation between those two rotators (Delta (Rotator)-Node), but for some reason this does not work…

I hope my solution holds. Needs some more tests.