-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange behaviour of NavigationAgent3D around NavigationObstacle3D #67712
Comments
Avoidance != Pathfinding Avoidance does not change the pathfinding only the velocity. Your path insists that the agent moves through the obstacles und enforces this every single _physics_frame update. 3D avoidance shapes are radius / spheres. Your box / rect shaped obstacles only have this shape for visuals or physics collision but for avoidance calculation they are in fact very large spheres that only leave tiny gaps for the agent to move through when they are "up". When the agent is close to the obstacle and the obstacle sphere moves down it "squeezes" the agent. The correct 3D avoidance would be to move through the floor but it obviously cant so it gives up with the suggested avoidance "safe_velocity" and moves on. If you have "ignore_y" enabled the safe_velocity will ignore the y-axis, so the agent basically stands still and waits for better times or until the obstacles moves its radius out of the overlap with the agent. Avoidance and especially the obstacles are due for a rework for Godot 4, progress is tracked here. |
I understand all this (i was author of c++ navigation integration for one of AAA titles released not long ago). What seems to be big problem for me is that avoidance sphere cannot be seen. Maybe drawing them at least as part of navmesh debug rendering, ideally even in editor would help a lot. Note i have Ignore Y enabled in agent props. Btw so avoidance is using navmesh itself for avoiding obstacles (seems it is not the case) but then again, i dont see the sphere so it is har to debug what system see internally 🤔 Great work btw! |
Good idea <3 |
Yes, it is difficult to find good avoidance property values without any debug visuals. Debug visuals for the editor are on the "to-do" list. Even with good property values and setup it is difficult with the current avoidance to get a good result. The RVO2-3D library currently integrated in Godot is intended for air, water or space agents and has issues with flat surface 2D avoidance in general as soon as things get more crowded or something pushes from above or below. It also has no support for hard-surface obstacles to build e.g. navmesh constrains. All current NavigationObstacles are just a (soft) avoidance radius created by a fake agent with some properties set at values that it can push most other agents but not all. These are issues that are outside of what a user can control or change without digging into the source code. As shown in the linked rvo rework proposal there are a few things currently worked on that should improve the avoidance situation for Godot 4. |
I see, thank you for great details!😊 Will be looking forward for further improvements then 👍 |
Looks nice! Will test it as soon as it is available in beta build 👍 |
Godot version
4.0.beta3
System information
macOS Monterey 12.6
Issue description
When navigation agent should go around moving obstacles it almost seems it pushes into obstacle until it is no longer there (i tested it by disabling collisions on them but visually agent behaved the same). I would expect agent to try to "get around" dynamic obstacle rather than wait for it to clear.
Steps to reproduce
Option 1:
Have agent go around 2 obstacles that are moving up and down (not sure direction has effect) each being down at different time. Their movement is done using animation player animating position attribute of parent node like so:
You will notice agent trying to get "through" obstacle rather than go around it.
Option 2:
Open repro project, start it and you can order red ball (agent) to go around level by lef mouse clicking on floor (clicking on purple walls and ramps will not react, only floor does).
Minimal reproduction project
Navmesh.zip
The text was updated successfully, but these errors were encountered: