Unreal Crashes, if I used GetActorLocation()

I wanted to see if I can grab it with constraint rotation, by using GrabComponentAtLocationWithRotation()
And used FRotator Object = HitResult.GetActor()->GetActorRotation(); , but that line of code crashes unreal engine. I was wondering If there is another way of finding the FRotation or am I missing something silly?

This is dereferencing GetActor and that might return a null pointer. You would need to check if it’s okay to dereference before you do

AActor* HitActor = HitResult.GetActor();
if (HitActor)
{
    FRotator Rotation = HitActor->GetActorRotation();
}
1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms