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 Link component, agents teleport across gaps.

Discussion in 'Navigation' started by thiskidcalledtom, Jul 25, 2021.

  1. thiskidcalledtom

    thiskidcalledtom

    Joined:
    Nov 9, 2017
    Posts:
    35
    Hello! I have a problem i've tried for about a week to try and fix. I have a procedurally generated dungeon, made up of prefab "rooms" that are connected via doorways.

    i pre-bake the navmesh per room, so they do not connect through the doors. I am using the "NavMesh Link" component to connect them through the doorways. But the agents just teleport across the gap. I just want them to walk through the door. Is that possible? Please let me know!

    Here is a video of the problem, and also some screenshots of the setup:

    Video of problem:


    Photos:
    upload_2021-7-25_14-11-32.png
    upload_2021-7-25_14-12-9.png

    upload_2021-7-25_14-12-57.png upload_2021-7-25_14-11-32.png upload_2021-7-25_14-12-9.png upload_2021-7-25_14-12-57.png upload_2021-7-25_14-11-32.png
     
  2. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    53
    The default behaviour is to teleport as you describe it.
    You will need to manually code the traversal from one Navmesh to the other.

    Check for the NavMeshAgent event isOnOffMeshLink. At this point, take over the movement until you are off the mesh link again. The simplest method is to take the velocity at the point of entering the link, and maintaining that velocity. Use the NavMeshAgent warp method to maintain the NavMesh awareness of where the character is.