Hi,
For some reason the LineOfSightTo function does not work on my AI character. Codes are quite:
Super::Tick(DeltaSeconds);
Player = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);
if (LineOfSightTo(Player))
{
UE_LOG(LogTemp, Warning, TEXT("Looking at player"));
SetFocus(Player);
MoveToActor(Player, 100.f);
}
else
{
UE_LOG(LogTemp, Warning, TEXT("Lost Player"));
ClearFocus(EAIFocusPriority::Gameplay);
StopMovement();
}
And the BP setup for AI
Thanks!
Edit: Just found out if I move up to the cube (like super close), it will rotates toward me but still wouldn’t move. Not sure how to fix it.