Navmesh, need an destroyable obstacle which will remove it's entity in terms of NavMeshPath
I have Destination
Destination is covered with fences all over
When one of the fences getting destroyed my agents should move to destination (In other words if path is clear)
ISSUES
I need to know status of the destination (CalculatePath) but this method ignores NavMeshObstacles and returns path as true even if the path is blocked
When the Fence is getting destroyed I need to update its navMeshObstacle so agents getting aware that they can move and only navMeshObstacle works this way. If I make fence static Not walkable, then I will have issues with updating path, as destroying this object do not destroy (Rebake) obstacle for navmesh.
REQUEST Unity devs, please, raise the ticket to review possibility to make so NavMeshObstacles would be considered when building a path, it's so needed and I saw many other people complaining about it
Looking for a solution to achieve what I want, I wouldn't like using A*
Answer by adriant · Feb 28, 2018 at 08:46 AM
Are your fence NavMeshObstacles set to Carve?
As explained in the documentation page for Nav$$anonymous$$eshObstacles, If the obstacles are carving the Nav$$anonymous$$esh then the path will definitely try to go around them. You'll just need to recompute the path after the carving happened.`CalculatePath()` returns true because it indeed finds a path but you can do an extra check for the path.status
and if that is Nav$$anonymous$$eshPathStatus.PathPartial
you'll know that the destination is isolated and cannot be reached , most probably because of the obstacles. A status of Nav$$anonymous$$eshPathStatus.PathComplete
means that the path reaches the destination just fine.
Regarding the fence containing the Nav$$anonymous$$eshObstacle and "destroying this object do not destroy (Rebake) obstacle for navmesh", have you tried first disabling the Nav$$anonymous$$eshObstacle component on that object and then destroying that object? Anyhow, I find it strange that the Nav$$anonymous$$esh doesn't "heal" once the carving obstacle has been removed.
Screenshots: 1. http://take.ms/lf5EJ 2. http://take.ms/NgL6i 3. http://take.ms/kbvv2 4. http://take.ms/sQ1xv
Carving is set by default, I do recalculate path and then the path status is shown as PathComplete. I never had a result pathPartial Regarding "Heal", yes it works on carving obstacle, if it gets destroyed it. But it's not the issue
ISSUE IS: 1. When I'm using Carved NavObstacle it gives me wrong results in Nav$$anonymous$$eshPathStatus 2. If I'm using Static Not-Walkable obstacle than it do not "Heal" when it get destroyed
Answer by Borjka · Mar 01, 2018 at 11:35 AM
My working mate gave me a great idea. I can make my own PathStatusCheck by comparing target transform with the end point of the path if they are same, then the destination is reachable else destination not-reachable.
I'll make a try for it and will answer here
I also wonder if it will affect my performance if there will be up to 100 objects with Nav$$anonymous$$eshObstacle components but carved
Aww, it doesn't work, as I told previously it does set destination to it's final point without counting nav$$anonymous$$eshObstacle :(
Your answer
Follow this Question
Related Questions
Farthest Reachable Destination 0 Answers
AI navigation on a moving platform 0 Answers
ai patrol and chase question 0 Answers
NavMeshLink don't work in correctly in certain area 0 Answers