How to: Get Location of Socket in C++

How do I get and store the location of a socket in C++?

GetMesh()->GetSocketLocation(“SocketName”);

FVector SocketLocation = GetMesh()->GetSocketLocation(“SocketName”);

Thank you! But how does GetMesh() know which mesh I mean? What if my class would have like 2 or more meshes each with different sockets? I.e. Mesh A has a socket named “Socket A” and Mesh B has a socket named “Socket B”. If I were to call GetMesh()->GetSocketLocation(“Socket A”); or GetMesh()->GetSocketLocation(“Socket B”); would this work? If yes why? If no how would I get the location then?

1 Like

I assumed it was bieng called on the PlayerCharacter in which GetMesh() gets the default skeleton for the character. If you want to get it on a specific mesh, simply just use the Components variable name.

SwordMesh->GetSocketLocation(“SocketName”);

You assumed correctly :-). I needed the location for a trace. Okay now I see how it works.

Thank you!