2 solutions work, But only 1 should be used here

First attempt i tried this

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

Console output:

LogTemp:Warning: SM_Rock_2 is at position 40.000000,-290.000000,20.000000|0.000000,0.000000,0.000000|1.000000,1.000000,1.000000
LogTemp:Warning: SM_Chair_5 is at position -210.000000,-60.000000,20.000000|0.000000,-40.000050,0.000000|1.000000,2.500000,1.000000

Then i tried

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

and the output:

LogTemp:Warning: SM_Rock_2 is at position X=40.000 Y=-290.000 Z=20.000
LogTemp:Warning: SM_Chair_5 is at position X=-210.000 Y=-60.000 Z=20.000

GetActorLocation() makes the output much easier to read, also i think GetActorTransform() is meant to get more rich information on actor rather than just where it sits.

Any other opinions?

1 Like

I used FString ObjectPos = GetOwner()->GetActorLocation().ToString(); as well. I generally think of transform as object movement from one vector to another and location as current vector.

2 Likes

I did the same. Saw it pop up under the drop down list. Glad I’m not the only one.

I used GetActorLocation() for mine. I noticed on the GetActorTransform() it returns all the values of location, rotation, and scale. The first three values on each object of your first output are the location values. Interesting to see what the output is using just GetActorTransform() is.

I used GetTargetLocation() for mine and there weren’t any differences in the format in mine.

Privacy & Terms