Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  3. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Navmesh obstacle carving - problem with agents

Discussion in 'Scripting' started by LHGameStudio, Nov 25, 2013.

  1. LHGameStudio

    LHGameStudio

    Joined:
    May 16, 2013
    Posts:
    35
    Hi all!

    I have a big problem. I use navmesh pathfinding. I have some enemy units with navmesh agent.
    If is enemy unit standing, this unit has enabled navmesh obstacle with carving. Other units move around this. Problem is here:
    Some of other navmesh agents don`t move(are stopped) , if I disable carving all works OK.

    How solve this problem please?

    Thank you for any ideas!

    Sorry for my EN ;)
     
  2. lynchemall

    lynchemall

    Joined:
    Nov 29, 2012
    Posts:
    3
    I'm running into the same problem. The autoRepath doesn't work in some circumstances. Every time you carve you seem to risk a certain number of agents getting stuck. Carving again frees some but blocks others. I'm trying to turn off the autoRepath and do it myself but no joy sofar. Have you made any progress?
     
  3. Dan Deibler

    Dan Deibler

    Joined:
    Mar 13, 2013
    Posts:
    16
    Has anyone found a solution to this bug? Was it fixed with 4.3.3? The changelog lists a few NavMesh bug fixes, but not this specific bug. I'm trying to figure out if I need to start the paperwork for the lengthy process of getting the update installed on our machines.
     
  4. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    620
    I gave up on using the carving on Navmesh obstacles, it seems they are changing the navigation mesh all the time, but fps drops from 60fps to 30fps just by the simple fact of adding a carved obstacle in the scene.
    And yes, the distance to recalculate is big.

    Also navmesh agents when I send them to move somewhere (around 40 navmesh agents), unity now crashes, while in 4.2 everything worked ok.
     
  5. Dan Deibler

    Dan Deibler

    Joined:
    Mar 13, 2013
    Posts:
    16
    It sounds like you're experiencing a related, but possibly slightly different bug I've noticed. In 4.3, the "Move Threshold" setting on NavMeshObstacle seems to be completely broken; it doesn't appear to have any effect at all. The nature of the FPS drop indicates that the obstacle is constantly carving the mesh, regardless of how much it has moved and regardless of the "Move Threshold" setting. It does appear (based on FPS) to not re-carve if the obstacle stays in exactly the same position, but if there is any change in position, no matter how small, it does seem to be re-carving. We got our team updated to 4.3.4 and it appears to still be broken. I think I'll put in a bug report and start a thread about that issue, because not being able to prevent it from recalculating the navmesh carving every single frame without giving up the ability to carve at all is completely breaking our game. The performance hit for recalculating the mesh carving every frame makes it borderline unplayable.
     
  6. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    620
    yup, I gave up on the carving, the fps hit was just too big.
    Please do submit a bug report, I already submitted one regarding the crashes that now happen when we try to move about 40 agents at the same time, this was not a problem before.

    Are you experiencing crashes with navagents ?
     
  7. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    4,194
    It would be great if you can submit a bug reporter with a project folder of low performance when carving.

    Also if agents are not auto-repathing. Please make a reprocase and log a bug.
     
  8. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    620
  9. Shinugami

    Shinugami

    Joined:
    Oct 17, 2012
    Posts:
    49
    Thanks for this thread; I found it very helpful. I also have the same problem where the Auto-Carving causes AI to get stuck. The downtime until an AI resumes movement seems far too long. Despite using Unity Pro I was almost about to totally remove the NavMesh navigation from my game; until I saw that, presently, objects with rigidbody components have a bug when dealing with carving. I'll work on other aspects of the game for now and if required later I will change the movement to something else; if the bug isn't fixed in the next version.
     
  10. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    223
    Are you talking about problem like this?

     
  11. JibberJabber

    JibberJabber

    Joined:
    Apr 4, 2013
    Posts:
    2
    Gua - we are having that exact problem. Also, if there is a single carving navMeshObstacle in the scene then a lot of our AI agents (with rigidBodies) are simply walking through ordinary collider objects (doors etc.).
     
  12. IPnose

    IPnose

    Joined:
    Jun 6, 2014
    Posts:
    12
    I have exactly the same problem. Is anyone found a solution?
     
  13. ryte2byte

    ryte2byte

    Joined:
    Jan 28, 2014
    Posts:
    2
    Having this exact same problem with Unity 5. 1 navmesh agent simply refuses to move if there are ANY navmesh obstacles in the scene with carving enabled and there are 4 or more agents in the scene.
     
    Last edited: Mar 12, 2015
  14. psilord

    psilord

    Joined:
    Feb 13, 2015
    Posts:
    3
    Using Unity 4.6.5f1, I've run into a very similar problem. In my case, an agent is outside of a room and trying to path find into the room. If I "lock" the door by having it carve the nav mesh when shut, the agent halts, goes into the PathFinding state, and never leaves it, even when I change the destination to somewhere it can reach! Only by "unlocking" the door, causing (the original) valid path to be in existence again, does the agent start going to where ever its _new_ destination was set. This is quite thoroughly frustrating.
     
  15. joaodeconto

    joaodeconto

    Joined:
    Apr 16, 2012
    Posts:
    4
    The best workaround I've found until now, is to check for isPathStale on AI update or create an event for carving notifications. Everytime you carve or move a carved object, it will stale some paths, which need to be recalculated. The autorepath doesn't seems to work, so using something like the code below, might be usefull. Another cause for massive agent freeze, is to set a destination.position out of the navmesh bounds, so check for partial paths and find a suitable point to calculate it.
    Code (CSharp):
    1. if(NavAgent.isPathStale)
    2.                 {
    3.                         if (NavAgent.pathStatus != NavMeshPathStatus.PathComplete)
    4.                     {                      
    5.                         if (NavAgent.pathStatus != NavMeshPathStatus.PathInvalid)
    6.                         {
    7.                             Vector3 randomVector = Random.onUnitSphere;
    8.                             Vector3 position = PathfindTarget - randomVector;
    9.                             position.y = PathfindTarget.y;
    10.                             NavMeshHit hit;
    11.                             if(NavMesh.SamplePosition(position,out hit,1,1))
    12.                             {
    13.                                 Move (position);
    14.                             }
    15.                             else Move(transform.position) //reset move
    16.                         }
    17.                         else
    18.                         {
    19.                             Move (PathfindTarget);
    20.                         }
    21.                     }                  
    22.                 }
     
  16. barbe63

    barbe63

    Joined:
    Oct 6, 2014
    Posts:
    35
    Please i'm having the same issue. I don't even carve when objects are moved but it's enough to mess everything. Look at this, if I remove carving everything works fine but when it's enabled the NPC can't find a way in the purple zone when it goes next to the door with obstacles. It's just stuck running...

    carveIssue.jpg
     
  17. weitay

    weitay

    Joined:
    Aug 5, 2012
    Posts:
    10
    Problem still persists with Unity 5.4 in 2016
     
  18. mjunaidch

    mjunaidch

    Joined:
    Oct 23, 2016
    Posts:
    6
    This problem still persists with 5.6.3... any body have solution for this.. I have 1 nav mesh obstacle on my player with carving On when player is moving then all nav mesh agent stop moving...I have to carving On because I don't want other nav mesh agent is passing in player....Can anybody Help me ??
     
  19. dienat

    dienat

    Joined:
    May 27, 2016
    Posts:
    234
    With Unity 2018 usintg dynamic carving makes the enemies go crazy moving to random places and also jitter a lot like if the enemy was being shaked very fast instead going to the player as its programmed and as it does when carving is not enabled. Also when using navmesh obstacles in moving enemies makes them move animations much faster, i also in reduced spaces they move slower dont know why, using navmesh obstacles makes everything stop working as it should
     
  20. Capella34

    Capella34

    Joined:
    Mar 19, 2013
    Posts:
    2
    Issue still persists in Unity 2017.4.9f1. I am having this exact same issue in my game. I run about 10-20 AI units at the same time and every time a NavMeshObstacle is added to the scene (which uses Carving), all of the units rotate for a second and then resume their path and a half of them just get stuck walking into NavMeshObstacles altogether.

    Valve pls fix
     
  21. ArchAngel075

    ArchAngel075

    Joined:
    Jul 12, 2015
    Posts:
    2
    I ran into a issue where carving enabled on runtime created obstacles caused all my agents to freeze.
    Using the new runtime navmesh scripts.

    A solution i use is to use a volume modifier that overrides the area with a non-walkable area on my stationary objects i create at runtime and removing navmesh obstacle component.
    Ofcourse this wont be viable for non-stationary objects.