Hey guys,
I am just wondering what is the difference between them two? I mean I know if I want to get the position of actor in a game (or anything else) I would use GetTransform but what is GetActorLocation for?
1 Like
A transform describes location, rotation and scale.
FTransform Transform;
FVector Location = Transform.GetLocation();
FRotator Rotation = Transform.GetRotation();
FVector Scale = Transform.GetScale();
1 Like
Adding to this answer, explicitly addressing the rest of the question, GetActorLocation() returns the same as the Transform.GetLocation(). GetActorLocation is a convenient way of just getting the location. This code:
FVector VehXYZ=CurrentVehicle->GetActorLocation();
FVector altvxyz= CurrentVehicle->GetTransform().GetLocation();
UE_LOG(LogTemp,Error,TEXT("VehXYZ is %s"),*VehXYZ.ToString());
UE_LOG(LogTemp,Error,TEXT("alatvxyz is %s"),*altvxyz.ToString());
produces the following output:
LogTemp:Error: VehXYZ is X=99.992 Y=1000.147 Z=14.511
LogTemp:Error: alatvxyz is X=99.992 Y=1000.147 Z=14.511