Cannot convert FHitResult to FHitResult *

Wanting to use the function bool SetActorLocation(FVector, bool, FHitResult, ETeleportType), I’m running to the error of the question title.

The API Page

The thing here is that the FHitResult has the pointer Symbol to it while being a function argument. How can I declare a variable (of type FHitResult*) to store it?

1 Like

You can declare your hit result like this:

FHitResult HitResult;

A pointer is basically just a variable that stores a memory address. This is why you can pass the address of your hit result by using

&HitResult

& is the address-of-operator, which returns the memory address of your variable.
So your function call might look somehow like this:

SomeActor->SetActorLocation(FVector(0,0,0), true, &HitResult, ETeleportType::None);

Hope that helps, let me know if you have any further questions.

1 Like