My way…
1 Like
I actually arrived to the same thing:
FVector ObjectPos = GetOwner()->GetActorLocation();
FString ObjectPosString = ObjectPos.ToString();
or in a simplified way:
FString ObjectPos = GetOwner()->GetActorLocation().ToString();
BUT!, there is a catch in there… When we do GetActorLocation, we return the Location filed olf the Transform, which is one field of the whole Transform struct.
By using Ben’s method,
FString ObjectPos = GetOwner()->GetTransform().GetLocation().ToString();
you eventually have access not just Location field but Rotation and Scale fields, perhaps before .ToString(), you could use a Set method that allow you to change any parameter of the Transform during runtime. In this case, it is usefull to use ToString in a subsequence statement, just to print out in console any transition of the Transform.