Anyone got the time to help me with a math problem?

I posted on Answer Hub but tought i put it as well.

I have a problem with a static mesh and a socket not being where where I expect it to be.
I have a mesh and in the editor I added a socket to it.
And added it to the relative location of (X = 0, Y = 300, Z = 0).
Now the actor I have the Static Mesh as the root component.

When I change the rotation of the mesh / Actor I expect the socket to be at the same location relative to the mesh and its rotation.

EDIT: For anyone that comes along is the solution I found.


FTransform SocketTransform = FTransform(socket->RelativeRotation, socket->RelativeLocation);
SetActorTransform(InstanceTransform);
AddActorLocalTransform(SocketTransform);

SocketWorldLocOnInstance = GetTransform();
// Manualy
const FTransform RelativeTransform(Socket->RelativeRotation.Quaternion(), Socket->RelativeLocation, FVector(1, 1, 1));
const FTransform NewRelTransform = RelativeTransform * InstanceTransform;


What am currently doing is this.


    SocketLocation = FTransform(TransformOfTheActor.GetRotation().Rotator() + MeshSocket->RelativeRotation, FVector(TransformOfTheActor.GetLocation() + MeshSocket->RelativeLocation));

Am no math wizard, as you can see.

But is a illustration of what am trying to do.

ilustrate.png

Thank you for any help.

You should be able to get the world-space transform of the socket using this: https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Components/UStaticMeshComponent/GetSocketTransform/index.html

Ohe my bad i forgot to mention that it is a instanced static mesh that have the sockets.
I been unable to find a way to get the socket transform for a instance.
So am attempting to work around that.