About how the AI can move to last seen location

Hi everyone
It might be a stupid question, but here goes! I was wondering how the AI continues to move towards the last known position of the player?
As I see it, should the target in the Fighter.cs not become null since we Cancel the action when the player exceeds the chaseDistance?

Does this mean that the Fighter’s target becomes null, but the call for the method in Fighter - MoveTo(target.transform.position) in update, is still executed, thus it moves towards the last known position?

Hope someone can help me understand
Best Regards
Despo

Once we are out of Chase distance, we’re no longer updating the MoveTo location with the NavMeshAgent, but up until that point, we’ve been setting the target location every frame. While the Player is no longer at that location, the NavMeshAgent is never told “oh, nevermind, stop” when we cancel Fighter’s action. That means that the NavMeshAgent’s destination is the last known position of the player.

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

Privacy & Terms