Search Unity

NavMeshAgent: how to disable "push" behaviour

Discussion in 'Scripting' started by Living-Liquid, Apr 9, 2014.

  1. Living-Liquid

    Living-Liquid

    Joined:
    Feb 4, 2014
    Posts:
    7
    hi,

    i have a problem with the NavMeshAgent.
    my player character uses a NavMeshAgent to walk around, and my ai also uses the NavMeshAgent.
    now the problem is, when the ai walks towards the player and get's close to it, it pushes the player away.
    how can i stop that weird behaviour?

    kind regards
     
  2. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Arsonistic likes this.
  3. Living-Liquid

    Living-Liquid

    Joined:
    Feb 4, 2014
    Posts:
    7
    I set the stopping distance (affects only the destination point).
    I Read the documentation and nothing solves the problem that agents push away other agents.
     
  4. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
  5. ThermalFusion

    ThermalFusion

    Joined:
    May 1, 2011
    Posts:
    906
  6. Living-Liquid

    Living-Liquid

    Joined:
    Feb 4, 2014
    Posts:
    7
    NavMeshObstacle is not an option.
    Because, both agents would need a NavMeshObstacleComponent, but then they will also avoid themself and jag around.

    The avoidance priority also did not disable the push behaviour.

    What i now did, was to set the radius of the agent to a real low value. Now they can intersect (i don't care at the moment) but they do not push others away.
     
  7. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    In all honesty - the built in Unity pathfinding is awful. You'd probably get more success using one of the many third party packages available.
     
  8. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    I've played with a fair number of 3rd party path finding systems from the Asset Store and they all have their strong points and limitations. I have 2 shipping games that use the built in path finding and I'm happy with it. I do which there were more how to documentation available for it but, IMHO, it is usable.
     
  9. VengadoraVG

    VengadoraVG

    Joined:
    Nov 21, 2015
    Posts:
    13
    it doesn't matter how happy you are with unity's navmesh, the only thing that matters in this post, is that it's impossible to stop the agents from pushing each others... it's also impossible to make the agents act like obastacles, and that's a harsh limitation when you want to make a RTS
     
    JohnnyConnor likes this.
  10. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    VengadoraVG likes this.
  11. Mecanamaral

    Mecanamaral

    Joined:
    Sep 24, 2020
    Posts:
    7
  12. Jesus_Omega

    Jesus_Omega

    Joined:
    Jan 30, 2019
    Posts:
    4
    If your capsule collider radius is greater than your agent radius not pushing them;

    Walk: agent.radius = normal radius;
    Stop: agent.radius = 0.001f;