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.
Thank you for any help.