Search Unity

Question NavMeshAgent does not reach destination(SOLVED)

Discussion in 'Navigation' started by alicja121, May 31, 2023.

  1. alicja121

    alicja121

    Joined:
    May 26, 2023
    Posts:
    5
    Hello, I'm trying to setup some AI. Figured I would start with something small so I created a mouse and some cheese for it to search for. I have the mouse looking for the cheese(spins in place right now), once it sees the cheese it starts to move towards it.

    All that works great, the problem is that it never reaches its target.

    When I look in the editor it shows the path and it is at the center point of the cheese. What I also see is that it is stopping more at the point of the path query node. The remainingDistance variable is sitting at 2.89... with my own distance measurement at around 3.0 when it stops. When I had it picking a random point on the navmesh it would reach its destination no problems.

    The cheese object is a box with the collider set to trigger, and the tag is cheese nothing else no scripts.

    The mouse object is a capsule on its side that is somewhat flattened with some spheres for eye's. Has a navmeshagent, my AI script, a sphere collider that is set to trigger; kind of acts like its sight/smell range.
    The script handles adding any cheese to a list that is in the sphere collider and removes them once they are no longer in range. It then uses that list to select the closest one and then sets a path to its location using SetDestination on the navmeshagent.
    Regards: Pubg Name Generator