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. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

NavMeshAgent teleports

Discussion in 'Navigation' started by Aseliot, Apr 10, 2020.

  1. Aseliot

    Aseliot

    Joined:
    May 7, 2019
    Posts:
    35
    Hi,

    I've used the NavMeshAgent before in another project and I wanted to use it again but now it just teleports somewhere else when I tell it move, it just does this a single time and then never moves.

    I have checked against my other working project and I see no differences in how I set it up?
    Anyone have any ideas?
     
  2. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,007
    I'm seeing this same issue. Adding lots of extra move destinations in between seems to fix it, but there should be no reason why it can't calculate a valid path from anywhere on the terrain. I also have never seen this before. I'm using Unity 2019.3.8f1. How about you?
     
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,007
    I actually found another way to fix. I had my agent radius set to .35 and when I went back to the default of .5 the issue went away. So, this has something to do with smaller agent sizes. Still trying to figure out how to get smaller agent radius and not have teleporting.
     
  4. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,007
    I spoke too soon. Even at .5 is still sometimes teleports. There seems to be no way to fix it except adding more waypoints. This is definitely a Unity bug, but doing a google search reveals that it's been around since many, many versions ago so I doubt it will be fixed.
     
  5. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,007
    For me, it turns out this may not be NaveMeshAgent related. When I create a simple navigation script to set NavMeshAgent destination, it works fine, but when I use EmeraldAI's SetDestination, it is failing. So, might be an EmeraldAI issue for me.
     
  6. Aseliot

    Aseliot

    Joined:
    May 7, 2019
    Posts:
    35
    In my case I think I was calling the wrong function instead of SetDestination
     
  7. MidniteOil

    MidniteOil

    Joined:
    Sep 25, 2019
    Posts:
    338
    I am seeing the same issue. I'm using Unity 2021.3.13f1. The enemy is teleporting over 50 units from its spawning position (not directly to the destination).
     
  8. MidniteOil

    MidniteOil

    Joined:
    Sep 25, 2019
    Posts:
    338
    BTW, I thought it might be an issue that I'm instantiating the enemies from a pool, moving them to their spawn position and then setting their navmeshagent's destination. I thought maybe it was an issue with the navmeshagent being active while moving them to their spawn location so I disabled the navmeshagent in OnEnable and then re-enabled it just before setting the destination. Now they don't teleport but they don't move either :(