Search Unity

How to make objects walk off edge of navmesh and fall?

Discussion in 'Navigation' started by frogfinder, Feb 20, 2019.

  1. frogfinder

    frogfinder

    Joined:
    Mar 29, 2018
    Posts:
    1
    Hi! I'm working on a game where I would like an object to be able to walk off the edge of a navmesh and fall. Is there a way to do this without using a higher step range?
     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    Hmmm, not really an "intended" way for this. The NavMesh is built specifically so agents can't just leave it.
    You basically would need to "fool" the NavMesh into thinking it's bigger than the edges of your surface.
    Perhaps what you could do, is create invisible colliders around every edge of the navmesh, include these in your bake and then when your agent walks over them, disable the agent and enable physics on the agen'ts rigidbody while turning the invisible colliders off.
    This might cause some trouble if you'd re-enable the NavMeshAgent afterwards though, for example having them land on another platform. Something to try out.
     
    nattd and frogfinder like this.
  3. Burger_Games

    Burger_Games

    Joined:
    Apr 20, 2021
    Posts:
    2
    In bake settings in the navigation window you can click on your agent and change a value called Drop Height.