Search Unity

Limit player movement to navmesh

Discussion in 'Navigation' started by Verdemis, May 21, 2018.

  1. Verdemis

    Verdemis

    Joined:
    Apr 27, 2013
    Posts:
    92
    Hello everyone,

    I'm quite new to navmeshes and I'm currently trying to figure out if there is a way to limit my players movement to the navmesh when he is controlled by gamepad or keyboard... and is not controlled by an agent?

    Best,
    Verdemis
     
  2. Verdemis

    Verdemis

    Joined:
    Apr 27, 2013
    Posts:
    92
    Ok I'm just very very stupid... I don't know why I didn't tried that, but adding an NavAgent to the player was the solution.
     
  3. neeboy

    neeboy

    Joined:
    Mar 25, 2019
    Posts:
    11
    Don't feel stupid...I'm trying to do the EXACT SAME THING and anything "Agent" I read about always seems to be about controlling an NPC, AI, etc. Keerypes, I've been searching for 3 days now...
     
    EZaca likes this.
  4. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    Well, as he says he added a NavMeshAgent to the player character and handled movement through that.
     
    HaiderBassim04 likes this.
  5. steevoni1

    steevoni1

    Joined:
    Aug 23, 2018
    Posts:
    1
    I have the same problem and I have setup the navmesh as well as have nav mesh agent yet the player still falls from the edge any help would be appreciated
     
    vir2al likes this.