Access Actor's Transform and Displaying

Hey Guys!

So it took me a little bit how to get this to work. My first try, i tried to grab the X, Y, Z positions separately and turn them into a string. I tried at least 30 different variations to get this to work. Also I wasn’t sure how to interpolate values while setting a variable to a string itself.

After playing around with it for about 30 minutes. I realized it needed to be wrapped in parenthesis. And also when you grab just the location itself from the transform, it displays the exact thing you want!

LogTemp:Warning: SM_Chair_2 is at X=390.000 Y=-230.000 Z=20.000
LogTemp:Warning: SM_Chair2 is at X=400.000 Y=290.000 Z=20.000

Success!

And apparently the next 5 minutes back into the video, i realize i didn’t need to interpolate at all… lol guess that makes sense!

Just wanted to add, i got the same result he did with…

FString ObjectPos = GetOwner()->GetActorLocation().ToString();

My question is, is this an updated version of what we just did? Or is this just another way of doing it?

Also is this good practice, or bad? Just curious about the difference.

Hey Enoch, I’ve been messing around with other tutorials, and I actually did my FString this way:

FString ObjectPosition = GetOwner()->GetTargetLocation().ToString();

I don’t know why I did target, but it has the same effect. Different ways to skin an onion i suppose.

I could see that :slight_smile:

Privacy & Terms