Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Unity AI - Pathfinding for different NavMesh agents - their sizes and areas

Discussion in 'Editor & General Support' started by DigitalBiteGames, Aug 11, 2017.

  1. DigitalBiteGames

    DigitalBiteGames

    Joined:
    Mar 30, 2016
    Posts:
    17
    Hello!

    I'm making Horror game with basically two types of agents. Human, which is small, and Monster that is bigger than human, especially in width (note: vents and corridors have different sizes).

    In Navigation window...
    The standard baking is working for the built-in humanoid agent - but I don't want to allow the monster to pass some ways because it is too big to go through them. Changing values in NavMesh Agent component in Monster, like "Radius" does not work like I imagine it should. Monster will still go same way like human would, colliding with its model and going to places where it should not be able to go.

    Human with humanoid agent type in NavMesh is working correctly but changing the size of Agent in Bake window will cause him to not access ways he could go, while it will fix monster pathfinding, logical.
    (It's like I'm forced to choose between Human Enemies and Monster Enemy)

    I tried using NavMesh Surface (of course on static object that is not moving), with different agents, areas and their value...
    It was kind of working, I mean, Agents were working and they were aware of their surface...

    But, using NavMesh Surface element and its baked Areas caused the agents to move towards a wall that was blocking their way instead of going through the big corridor - the only way to leave the room ... adding NavMesh Obstance didn't work.
    Strange is that NavMesh's coloured area clearly shows that there is no way through, Agent should not have problems to find the way to leave.
    Going back to standard baked navigation and changing Monster's NavMesh agent back to built-in Humanoid is working like it should, Monster or Human will find a way to leave. Back to the beginning, sadly.


    Also, I wanted to make Agents prefer to move in the centre of corridor instead of hugging walls, so I tried to make big Agent, that with NavMesh baked surface created specific area I wanted. I changed the value of it, so Agent would prefer to use it than other accessible ways if available.


    Conclusion:
    I cannot make differently sized agent for a bigger enemy, to limit its possible way to the player.
    Baked navigation pathfinding is working, NavMesh Surface not.


    I'm missing something or...? Any ideas? Thank you in advance! I hope that I mentioned all of the crucial pieces of information and details.

    Other information:
    Using Unity 5.6.2f1 (64 bit) Personal Edition
     
  2. DigitalBiteGames

    DigitalBiteGames

    Joined:
    Mar 30, 2016
    Posts:
    17
    I can also send/link examples of what is happening if it will help find solution.
     
  3. DigitalBiteGames

    DigitalBiteGames

    Joined:
    Mar 30, 2016
    Posts:
    17
  4. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    702
    If you go to bake, in the navigation tab, there is a link that says "learn instead about the component workflow"
    It takes you to a git hub for an unofficial way to have multiple navmeshagents.
    I have not tried it out yet.
    I am giving A* project a try instead.

    I have no idea why unity would have the option to make multiple agents, but only one mesh. I am about to ask that right now.