Obtaining Coordinate of Static Mesh

How would I obtain a world coordinate of a certain point in a static mesh component in C++?

Hi @KallenTu the easiest way to set up getting the world co-ordinate of a known point of a static mesh would be

  1. Set up a socket at the static mesh’s as mentioned by this ** tutorial. **
  2. Call to get a sockets world transform by passing in the socket name to GetSocketTransform() of UStaticMeshComponent of the Actor in question.

You can replace “localPosition” with your mesh point vector:

UStaticMeshComponent* staticMeshComponent;
/* assign valid pointer value to staticMeshComponent */
if( IsValid( staticMeshComponent ))
	const FVector localPosition(1.0f, 0.0f, 0.0f);
	const FVector worldPosition = staticMeshComponent->GetComponentTransform().TransformPosition( localPosition );