Hi,
I use Recast Navmeshes together with RVO local avoidance.
- I have a scene with a parking place and a car on it.
- I create a Recast Navmesh and can see that the navmesh has a hole where the car is. So I would expect, that no pathfinding should happen through the car.
- If I place a group of RVO agents on one side of the car and move my first person controller on the other side of the car, the group tries to reach me and some of the agents walk straight through the car (=hole in the navmesh).
Why do they ignore the hole in the navmesh? Is the RVONavmesh Component the solution?
Best regards,
Josef
I can now answer this question on myself: I have to use RVONavmesh so Navmeshes can work per definition.
BUT: RVONavmesh and also RVOObstacle… does not work for me.
My agents seem to ignore both modifiers. Sometimes (but not always) the stop on the borders from the RVOObstacle rectangle. But one of the agents always gets across the line after a few seconds and the others follow.
Don’t know why. Can someone help me, please? A sample for this obstacle topic on recast meshes would be great.
Agents can sometimes cross obstacle borders. It happens when an agent has a too high velocity so that the center of it will be placed on the wrong side of the obstacle (border) after one timestep. The solution is to increase local avoidance simulation fps (on the RVOSimulator component) or increase the agent radius since they will avoid it at a further distance then (however I suspect that only increasing simulation fps is a viable solution).
For me, RVONavmesh and RVOObstacle are working. But I have a doubt about how the height of these obstacles is managed. I have already noticed some ignored RVOObstacle when their origin is a little under the ground, even if with the height they should be largely taken in account.
Thanks for your comments.
I found out that RVONavmesh seems not to create obstacles where the vertices next to each other are connected clock wise. Try it out: use debug.drawray on each vertice added to the obstacle list created by RVONavmesh and increase the ray’s length in a foreach loop.
If I use only the RVOObstacle without the RVONavmesh everything works great. No RVO unit walks inside the obstacle.
But if I activate also the RVONavmesh component all units ignore the obstacles. I can see in debug mode that the green path lines take the navmesh in account but the units are still walking straight through it as if the navmesh wouldn’t be there.
I have the strong feeling that the vertices created by the RVONavmesh component dont form a hull where each vertice is connected to its closest neighbour clockwise (or anti clockwise).
Also the RVOSimulator unwinding code only sorts the vertices on the x axis but not on the z axis.
Sorry for being annoying about the RVO code. Maybe an example scene with recast meshes and RVONavmesh + RVOObstacle on your website would clarify the things?
Greetings Josef
Ok. It works now. It seems as if raycasting for the y position of the agent didn’t work. I had to adjust height and Center.y in RVOController. Now everything works fine.
But now I have an automatic RVOObstacle creator for meshes and also trees (took me a week of digging through the code. Now I have a better understanding of everything. So far on the good side ).
This library is so great !
Ok: My ego hurts cause I don’t understand what the code in the RVONavmesh.cs does exactly but maybe I learn to live with that
Josef
The code in RVONavmesh does this, basically:
- Loop through all nodes and find the edges which are NOT shared with another node, i.e it is an exterior edge in the mesh.
- Construct that edge and find out the height of it, which I define as the difference in y-coordinate between the start and end of the edge. Then add it as an obstacle (yes, a line obstacle) with the calculated height.
Slightly more commented source code: http://paste2.org/yB3jKcNI
Thanks Aron. Comments are very helpful (not only) in this case.
Josef