Building Escape - Getting an actor's location - my version

I did it a little different because I didn’t like the three coordinates being smooshed together:

	FString ObjectName = GetOwner()->GetName();
	UE_LOG(LogTemp, Warning, TEXT("This component is attached to: %s"), *GetOwner()->GetName());
	FVector ObjectPosition = GetOwner()->GetActorLocation();
	UE_LOG(LogTemp, Warning, TEXT("Object %s is located at X: %.1f, Y: %.1f, Z: %.1f"), *ObjectName, ObjectPosition.X, ObjectPosition.Y, ObjectPosition.Z);

I wanted a bit less precision with the print out also, hence the %.1f.


Awesome job!

Privacy & Terms