Position --> Why not GetTargetLocation()

GetOwner()->GetTransform()->GetLocation().ToString() makes sense. I am telling the code to go the Actor/Owner this script is assigned to, and on run, get the Transform for that Actor, the Get the transform’s location.

But why not do GetOwner()->GetTargetLocation().ToString()
Here I am defining the target as the Actor, and I want its location.

The results are the same. The only thing I can think of is that in the future, we could want to have the location of the Player; instead of static meshes within the scene. And GetTargetLocation() may not jive with the Player Actor.

Wow Yet another Function that does the same thing!

I was trying to do some research to figure out what the difference was between

GetTranslation()
and
GetLocation()

and just wound up finding a third option.

I saw the TargetLocation thing on autocomplete, but hovering over it it mentioned something about firing weapons at the actor, so I didn’t go with it - it’s interesting that the best place to fire at something is at its location!

I found another one called GetActorLocation so the code looks like this:

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

Heh - yes sorry, I should’ve said that that was what I went with as well :slight_smile:

I also used GetActorLocation as part of the challenge, and added another output line to send it as an error with red text to compare the output. The output looks the same. Is there any difference between using one over the other?

I imagine that by the end we’ll be able to compare the times for each method. Maybe…

I would imagine so, performance checks are generally important to ensure that things are running well

I also used GetActorLocation !

Privacy & Terms