Search Unity

NavMeshAgent physics

Discussion in 'Navigation' started by LeSunset, Nov 28, 2021.

  1. LeSunset

    LeSunset

    Joined:
    Apr 4, 2021
    Posts:
    1
    Hey community,

    I'm looking for a way to use NavMeshAgent with physics. So my AI gets a way more natural behaivour. I want to add thinks like random jumping to my AI and it should fall with normal gravity from objects.

    But I can't find any good ways to implement gravity to NavMeshAgent.

    Is there a way to get this done?
     
  2. N7D

    N7D

    Joined:
    Feb 25, 2017
    Posts:
    9
    You could try using navmesh only to calculate paths, while having actual agent moving disabled. Then you can use this path to follow it manually by your own code. But making sure that you somehow stay within navmesh is on you too.

    You could also use some 3rd party pathfinding tools for that, they may be better suited for this.

    P.S. You could always use navmesh agent normally and disable it temporarily, for example when you want it to jump and reenable it later.
     
  3. toonlets

    toonlets

    Joined:
    Apr 3, 2021
    Posts:
    11
    Just a quick thought, but could you have a parent be the agent and then add random animation, etc., on the child?