Search Unity

AI trying to move between two objects that are to small

Discussion in 'Navigation' started by Shadowing, Aug 17, 2019.

  1. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Anyone have any ideas why my monster guy is trying to fit between two objects. This stump and rock when he can't fit through it. I have his AI agent set way larger than him.
    Shouldn't he only find paths where he can fit through?



     
  2. Grizmu

    Grizmu

    Joined:
    Aug 27, 2013
    Posts:
    131
    Is the agent size of the monster adjusted to the collider size? This might happen when agent thinks that he's small enough to fit, but the colliders don't allow him to.

    Same thing with the stump and the rock, which might not be navmesh static, but still have a collider that blocks the monster.
     
  3. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Thanks for the reply Griz.
    ya i have the agent size set way larger than him. Way past all his colliders.

    Here is how the NavMesh looks. The stump and rock are using mesh colliders.


     
  4. Grizmu

    Grizmu

    Joined:
    Aug 27, 2013
    Posts:
    131
    See that small area where the navmesh connects between the stump and the rock? That's where your agent is trying to fit, but he is obviously bigger than that, and this passage shouldn't be there.

    You need to configure navmesh baking to suit agents that use it. You can add multiple agent types and bake separate navmeshes for them, so you can have the best navmesh for both, small and big agents. You'll know when the navmesh is right when the connection between stump and the rock dissapears after the bake.
     
  5. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Thanks Griz. I guess my understanding on how nav mesh works is wrong lol.
    What's the point of having a nav mesh radius on the ai agent then? If it's just going to go by the nav mesh?
     
    Last edited: Aug 17, 2019
  6. Grizmu

    Grizmu

    Joined:
    Aug 27, 2013
    Posts:
    131
    You can think of it as a "dynamic" radius, which is used for avoiding other agents and dynamic obstacles.

    The radius set in the agent type is used in the baking of the navmesh from static objects.
     
    Shadowing likes this.
  7. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,648
    Oh ya that's right. Now I remember reading that 6 months ago.
    Thanks Griz
     
    Grizmu likes this.