Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. We're running great holiday deals on subscriptions, swag and Asset Store packages! Take a peek at this blog for more information!
    Dismiss Notice
  3. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  4. Unity 2017.2 is now released.
    Dismiss Notice
  5. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  6. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  8. Unity 2017.3 beta is now available for download.
    Dismiss Notice

[SOLVED]How can I stop Navmesh agent sliding in Unity5?

Discussion in 'Navigation' started by TakaakiIchijo, Jun 10, 2015.

  1. TakaakiIchijo

    TakaakiIchijo

    Joined:
    Mar 16, 2013
    Posts:
    2
    Hi, Im trying to make Pause function on my enemies (without changing timescale).

    Those characters are attached NavMeshAgent component, and using SetDestination() to following player.

    When the game is paused, I called function "NavMeshAgent.Stop(true)" in Unity 4.3 .

    The (true) option named "stopUpdates" means stop immediately NavMeshAgent without sliding.
    http://docs.unity3d.com/412/Documentation/ScriptReference/NavMeshAgent.Stop.html

    But this option is deleted later than Unity 5, I guess.


    Somebody said change setting acceleration value to higher, but it's dosen't work.

    http://answers.unity3d.com/questions/236828/how-can-i-stop-navmesh-agent-sliding.html

    And I tried using "NavMeshAgent.updatePosition = false".
    Then enemy character stopped, but the NavMeshAgent component was keeping moving separate from parent Object(enemy character model).

    http://forum.unity3d.com/threads/an...stopping-could-you-please-have-a-look.180623/

    So when I set "NavMeshAgent.updatePosition = true", the enemy character warp to unintentional position.

    Please tell me how to solve this issue.
    SFMPE.
     
    Harinezumi and williammotta like this.
  2. TakaakiIchijo

    TakaakiIchijo

    Joined:
    Mar 16, 2013
    Posts:
    2
    Through many trial and error, I found solution finally.

    Set velocity Vector3.zero before call Stop();.

    navMeshAgent.velocity = Vector3.zero;
    navMeshAgent.Stop();

    http://docs.unity3d.com/ScriptReference/NavMeshAgent-velocity.html

    If it will be used as reference for someone.


     
  3. fumangy

    fumangy

    Joined:
    Mar 28, 2013
    Posts:
    17
    Thanks !!!
     
  4. rickygow

    rickygow

    Joined:
    Jan 9, 2015
    Posts:
    1
    YOU MY FRIEND, ARE THE REAL MVP
    need hours to find this.
     
  5. mbue

    mbue

    Joined:
    Jan 19, 2017
    Posts:
    5
    Thank you - I also searched for that like half a day :)