I trying to trace from enemy to player
//Tracing:
Player = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);
FVector Start = GetTransform().GetLocation();
FVector End = Player->GetTransform().GetLocation();
FHitResult HitOut(ForceInit);
FCollisionQueryParams TraceParams(FName(TEXT("VictoreCore Trace")), true);
TraceParams.bTraceComplex = true;
//TraceParams.bTraceAsyncScene = true;
TraceParams.bReturnPhysicalMaterial = false;
GetWorld()->LineTraceSingle(
HitOut, //result
Start, //start
End, //end
ECC_Pawn, //collision channel
TraceParams
);
if (HitOut.Actor == Player)
{
FoundPlayer = true;
}
Editor closes with an “unhandled exception” message when i hit play. If i remove trace, then evrything ok. I think problem in FVector End = Player->GetTransform().GetLocation(); But i dont know how to get player position in FVector.
Thx.