Download

GetActorLocation() does not return its mesh location

Hi :slight_smile:
Thanks for taking some time helping me.
I’ve a object A attached to another object B. The image shows A flying because of B’s gravity. Every tick I ask for A’s position with GetActorLocation() (same result with GetRootComponent()->GetComponentLocation()) and draw some green lines in every direction.
In this image, above my small black/grey object A do all lines meet - thats the GetActorLocation(). But it should be right inside A. It is in A if its not moving, but once it’s moving the GetActorLocation() differs from the mesh.
How to fix it, please? I’m using C++ only.

Thanks a lot for helping!
~L

Hello [USER=“1384187”]Joe Wilcox WisE[/USER] & @ryan20fun,
So my object A is attached to a vehicle. I created a socket in the vehicle mesh and attached my A to is with:

A->AttachToComponent(Vehicle->GetRootComponent(),FAttachmentTransformRules::KeepRelativeTransform,FName(“Socket_Position”));

I’ve attached 2 better screenshots. Hopefully you can help me now :slight_smile:

edit: Also I can see the GetActorLocation() of the vehicle “moving” when the vehicle is moving if that matters.

edit: first is how it looks like when speeding up (same for driving curves - it shifts to a side then)
second shows how it should look like