[NavMeshAgent] isOnOffMeshLink + Move()

Hello,

I’m currently trying to make use of the NavMesh - OffMeshLinks. For NPC controlled characters (using NavMeshAgent.SetDestination) everything is working fine. However for the player controlled character (using NavMeshAgent.Move), the isOnOffMeshLink doesn’t report anything. I tested it with manual and auto generated links. I was hoping player controlled agents could automatically make use of the links as well.

Here’s some pseudo test code for the scenario in case I’m missing something. The player character does walk right into the link area in my scene.

using UnityEngine;
using System.Collections;

public class test : MonoBehaviour {
    private NavMeshAgent navMeshAgent;

    void Start ()
    {
        navMeshAgent = GetComponent<NavMeshAgent>();
        navMeshAgent.autoTraverseOffMeshLink = false;
        //navMeshAgent.destination = Vector3.zero; used for npc's
    }
   
    // Update is called once per frame
    void Update ()
    {
        navMeshAgent.Move(Vector3.forward * Time.deltaTime); //used for player

        if (navMeshAgent.isOnOffMeshLink)
            Debug.Log("OffMeshLink");
    }
}

Thanks in advance

Hi, I met the same problem, did you solve it ?

Nope… the agent doesn’t seem to report this while its player controlled. I didn’t pursue it any further, but I think its best to rely on manually generated off-mesh links and add triggers to register the player character, so you can still use the in out points.

Same problem.

NavMeshAgent.isOnOffMeshLink always returns false.

Any more information on this? I am seeing the same behaviour, NavMeshAgent.isOnOffMeshLink always returns false.

This still seems to be broken - did anyone manage to solve?

@Jakob_Unity
Any feedback is welcome.

I cannot get this value to return true on a velocity controlled agent, despite following your post at : How to trigger a Jump on an offmesh link - Unity Engine - Unity Discussions

1 Like

@zortech
@GuoRay
@NTDC-DEV
@Eclectus
@Robosaru
@Jakob_Unity
@Psyco92

hi, Guys
Are you solve this?
Any good news? please?

This still seemingly has issues. Haven’t tried in 2018.1 but I didn’t see any relevant fixes mentioned. What I’ve found is that it works only if the NavMeshAgent has a collider on it, and only if using pathfinding (versus .Move() or .velocity). That’s too heavyweight for what I need, since I don’t want to recalculate a new path every update for small movements of my player character. Any thoughts would be welcome.

Unity 2018.1.3f1. Still doesn’t work with player controlled character.

Still does not work in Unity 2018.3.0f1, I’m not sure why they haven’t fixed this yet.

Unfortunately this is still a problem. I’m currently building a VR game where the player controls their movement via a NavMesh Agent. The “Player Agent” is moved by calculating a propulsion value and then feeding this into navMeshAgent.Move(actualPropulsion). The system works very well for movement and I get the added benefit of “Walls” because the “Player Agent” can’t move beyond the NavMesh. But now I want the Player to jump off ledges/platforms. The Player can not do so, because they’re now grounded to the NavMesh. I hoped using OffMesh links, would solve this problem, but have discovered that OffMesh Links only work if you’re using SetDestination(). I hoping someone has discovered a way to use OffMesh Links when using .Move() on the NavMesh Agent.

1 Like

you dont need to do that, because you’ve controller the player all the time ,what you need is just close the agent by navmeshagent.enable=false,and then set transform.position directly. after teleport finished just set agent.enable = true