Search Unity

navmesh Obstacles - broken?

Discussion in 'Editor & General Support' started by pneill, Nov 4, 2012.

  1. pneill

    pneill

    Joined:
    Jan 21, 2007
    Posts:
    207
    Has anyone else looked at the navmesh obstacle feature in unity 4? Maybe it's just me, but I was honestly expecting a lot more from this feature. In my mind, the way this should work is that the navmesh agent should take into consideration dynamic obstacles when calculating a path. That's not at all what I see. Instead, it looks like the navmesh agent just bumps into the thing and then struggles around it. It looks terrible and frankly doesn't seem much better than simply adding a navmesh agent to an object.

    Am I doing something wrong or is this seriously the feature?
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
  3. iossif

    iossif

    Joined:
    Mar 4, 2011
    Posts:
    332
    you cannot work with them in the current state. the workarounds to make it work "good" are way too much work.

    they will get better in 4.x i hear. whatever x will be...
     
  4. nbalexis1

    nbalexis1

    Joined:
    Jul 21, 2011
    Posts:
    89
    is it still broken in 4.2?
     
  5. KurtK

    KurtK

    Joined:
    Sep 16, 2013
    Posts:
    1
    Seems to be. I can't get them to work. They just bump into the navmesh obstacle and stop moving if it's a lower priority. This is a nightmare to deal with. I think I'm going to have to buy the A* Pathfinding Project from Aron since it can do local avoidance.
     
  6. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Ya I tried working with the Unity navmesh for my rts game, but from what I remember, the local avoidance was great, but the dynamic obstacles and updating during runtime stuff basically didn't work. I can't remember exactly, but for some reason, I chose to keep using Aron's A* as well.
     
  7. Shinugami

    Shinugami

    Joined:
    Oct 17, 2012
    Posts:
    54
    Yep, broken for me too. Let's say I have a pillar of 2x2 crates. The crates have NavMeshObstacle components which only allow a radius for the collision - resulting in a cylinder collider. This means the pillar is made up of 4 cylinders - so as an obstacle it kind of looks like a butterfly or X shape. :eek:

    So I have an enemy AI on one side of the pillar and the player is on the other side.
    The AI gets stuck between the 2 colliders on any side of the pillar and is not sophisticated enough to repath around. :neutral:

    I like the NavMesh instead of the 'DynamicNavigation' asset which I bought because the NavMesh results proved to be smoother and faster however this NavMesh agent's lack of intelligent pathfinding when dealing with NavMeshObstacles is pathetic. :-x

    I'll have to work with what I have got so I'll do a test for speed and if the AI is sitting in the same place for too long I'll move the current waypoint target to a different or random location between the player and the AI. Then when the AI has moved X amount I'll restore the waypoint target to the player so the AI chases the player again.:cool:

    Update: My method works fairly well. There are probably better ways to do it but I make the AI chase a temporary target which is moved to a random x,y of a value. I pulse the logic every 2-3 seconds and after chasing that temporary target it sets it's target back to the original target. This prevents the AI from getting stuck on pillars. It looks kind of realistic in that it cautiously but quickly moves around the pillar. I'd post my code but it's messy so hopefully the pseudo code is inspiration enough.
     
    Last edited: Nov 3, 2013