Search Unity

Question about enemy AI

Discussion in 'Navigation' started by FishFace, May 13, 2021.

  1. FishFace

    FishFace

    Joined:
    Apr 20, 2011
    Posts:
    99
    Hi,

    I am currently making a game where the enemy chases the player and avoids obstacles if they get in the way.
    For that purpose I have made waypoints around the obstacles by which the enemy navigates around them.

    My problem is this:
    The first time the enemy encounters an obstacle when chasing the player the enemy knows where the player is at that time. But if the player still keeps hiding from the enemy by the time the enemy has approached the earlier position of the player the enemy does not know for sure where the player is hiding. So what should the enemy do at that point? Below I have posted some images to illustrate my problem. I hope somebody can help me.

    The enemy is marked green and the player is marked orange. The white rectangles around the obstacles are waypoints.

    The waypoint marked yellow in the second image shows the waypoint at which the enemy starts its search for the player.

    In the third image the player keeps hiding from the enemy and the enemy does not know for sure where the player is hiding. enemyChasing_01.JPG enemyChasing_02.JPG enemyChasing_03.JPG