This is how I did it before viewing solution

I haven’t watched to the end of the video yet, but I think I did things a bit differently. It seems to work just fine though. Here is my code:

AActor* OurActor = GetOwner();
FString ObjectName = OurActor->GetName();
FVector ObjectLocation = OurActor->GetActorLocation();
UE_LOG(LogTemp, Warning, TEXT("%s is at x=%f, y=%f, z=%f"), *ObjectName, 
	         ObjectLocation.X, ObjectLocation.Y, ObjectLocation.Z);

Nice! That’s good to know. Thanks for sharing.

1 Like

Cool. I used GetActorLocation as well and noticed that I didn’t need separate strings for x, y, and z if I convert them in the definition…

	FString ObjectPos = GetOwner()->GetActorLocation().ToString();
UE_LOG(LogTemp, Warning, TEXT("Position Re`z`port 2 Reporting %s is at %s\n! "),*ObjectName, *ObjectPos);
1 Like

Yes, when I watched the rest of the video I noticed that I had forgotten about ToString(). It’s gotten quite powerful over the years, and I want to keep that in mind.

I did pretty much the same. I used %0.1f in the string so it didn’t print all those zeros.

1 Like

this is my solution, outstanding for those who found the .x .y .z as separate properties :slight_smile:
awesome!!! I’ll watch the rest of the video

Privacy & Terms