I’ve been doing some basic AI and i’ve managed to get a basic AI that ‘should’ move towards a pawn. I go through the breakpoints in my code here:
void ABaseAIController::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
APawn* MyBot = GetPawn();
if (MyBot == NULL)
{
return;
}
else if (!target)
{
for (FConstPawnIterator It = GetWorld()->GetPawnIterator(); It; ++It)
{
ALivingEntity* TestPawn = Cast<ALivingEntity>(*It);
if (TestPawn && MyBot != TestPawn)
{
target = TestPawn;
SetFocus(target);
MoveToActor(target);
}
}
}
else if (MyBot != target)
{
SetFocus(target);
MoveToActor(target);
}
}
and it runs MoveToActor in both case but the pawn never moves. The bot does rotate, i.e. SetFocus but doesn’t go towards me. Is there anything that could cause this?