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. Dismiss Notice

NavMesh Help.

Discussion in 'Scripting' started by MegaWorld_Vlad, Jun 30, 2014.

  1. MegaWorld_Vlad

    MegaWorld_Vlad

    Joined:
    Apr 3, 2014
    Posts:
    13
    Hello. I faced with problem when using navmesh. I got 4 characters, that player can control, when one of them walking between two other it stucks and walking too slow, and after, when it already walked through them, it's starting walk with normal speed. So, my question is: How to solve that problem? Maybe i can lower friction between colliders, or something like that?

    Avoidance is not solution for me.
     

    Attached Files:

    • LOL.jpg
      LOL.jpg
      File size:
      67.4 KB
      Views:
      707
    Last edited: Jun 30, 2014
  2. karljj1

    karljj1

    Joined:
    Feb 17, 2011
    Posts:
    440
    Hi,

    It sounds like your objects colliders are hitting each other and slowing the entity due to friction/collisions. This is likely due to your NavMesh agents radius being lower than your colliders radius. Try increasing this value so it is at least the same as the colliders you have on your entities.

    http://docs.unity3d.com/ScriptReference/NavMeshAgent-radius.html
     
  3. MegaWorld_Vlad

    MegaWorld_Vlad

    Joined:
    Apr 3, 2014
    Posts:
    13
    Thanks, but what if distance between two agent lower that size of 3rd character? It's still trying to walk between them. How can i fix that?
     
  4. karljj1

    karljj1

    Joined:
    Feb 17, 2011
    Posts:
    440
    I'm not sure I understand your question.
    Are you asking what if the characters are not all the same size? You should be able to set the radius for each NavMesh agent individually.
    You can also improve things by adding a custom physics material to your entity colliders which has zero friction.
    http://docs.unity3d.com/Manual/class-PhysicMaterial.html
     
  5. MegaWorld_Vlad

    MegaWorld_Vlad

    Joined:
    Apr 3, 2014
    Posts:
    13
    Thank you for your time, but i solve that problem in different direction. I keep my collider and agent size like on screenshot, but i made script, which is increasing avoidance from 0 to 50 when i moving character, also i set 0 friction to my box collider, now if i move character they almost always have different avoidance and knocking each other without stuck)
     
    karljj1 likes this.