-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
3.5b1 navigation agent seems to sometimes bump around an obstacle in a way that feels like a bug #57486
Comments
@BigZaphod the behavior on the video you attached is normal - this is how it looks like when small-radius agent avoids big-radius obstacle. What do you mean by jumping and bumping? Is that smth else than what one can see on the video? |
The video is basically what I was seeing - the results seem to depend a lot on where the obstacles are in relation to each other and sometimes the agent acts like it hits an invisible wall pretty far out from where the obstacle actually is. I guess if that's expected behavior then that's fine, but the sudden velocity change feels so jarring that I assumed it was a bug. Are there ways to mitigate this sort of thing? (And if there are, perhaps it could be fodder for the eventual documentation?) |
by default obstacle's radius is estimated from collision shape - as for rectangle, the resulting radius will be big enough to include your rectangular collision shape inside the circle it creates. This leads to the obstacle radius being too big around the corners. You can disable estimation and set something smaller to work around that effect. Also, you can increase agent's time horizon. |
FWIW I just tried this project in 3.5b4. The pathing looks better - it takes the shorter path around the right of the object instead of the left, and doesn't "suddenly" notice the obstacle anymore. One thing that does still seem to be an issue is that the mob's speed isn't constant, and I'm not sure why. The speed being passed in to $NavigationAgent2D.set_velocity is a constant 100, but the magnitude of safe_velocity sent back to _on_NavigationAgent2D_velocity_computed ranges from 100 to 85-ish. I'm not sure why, especially given that the obstacle is static. You can see this by using OP's project, but adjusting _on_NavigationAgent2D_velocity_computed:
Anything I'm missing? |
The speed is not constant cause the RVO avoidance is a number of circles that apply different forces pushing agents in directions and not a perfect "this is your new path highway" calculation were the agent can run along at maximum speed. For maximum speed you need to not used the avoidance for (static) objects at all. Instead, bake your navmesh or update your navigationpolygon so the agent is aware of the scene geometry at high detail. The obstacle avoidance is a last resort intended for objects that are constantly moving as it would be too performance costly in many cases to bake them into a navigationmesh every frame. |
Ah, I see. Thank you for your reply! (I'm not the issue OP, but I wonder if this should be closed since everything seems to be working as expected) |
It is still open cause, while the current 3.5 navigation documentation "exists", it still misses a lot of information like this. |
I tried throwing together a very simple test of the navigation with an obstacle in the 3.5b1 build and it seems to behave oddly with the agent sometimes jumping or bumping as if it hit something. I can't tell if I've set this up wrong or am missing something or not, but I assume this isn't expected behavior? I used the blog post as a guide to configuring the agent and obstacle, but I can't rule out that I did something stupid here.
Godot3.5NavTest.mov
The scene tree looks like this:
And this is the only script (attached to the player):
Full project:
Godot3.5NavTest.zip
Originally posted by @BigZaphod in #48395 (comment)
The text was updated successfully, but these errors were encountered: