Skip to content
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

NavigationAgent3D receives safe_velocity vectors that are the opposite of safe #48025

Closed
smix8 opened this issue Apr 19, 2021 · 5 comments
Closed

Comments

@smix8
Copy link
Contributor

smix8 commented Apr 19, 2021

Godot version:
Godot 4.x
commit 29775a1

OS/device including version:
Win 10 64x

Issue description:

NavigationAgent3D receives safe_velocity vectors that are the opposite of safe from the collision avoidance algorithm calculated by the NavigationServer3D.

The returned safe_velocity actively attempts to push agents off the baked navigation meshes or even down cliffs without any collision geometry below.

RigidBody3D agents that move directly with calculated safe_velocity are immediately stuck and lost forever because they fall out of the map. KinematicBody3D agents can be saved but require additional raycasts to stay on the map because the collision avoidance tries to actively kill them.

It seems the only thing the algorithm cares about are other agents in the area of the agents path_max_distance. It treats the entire gameplay scene as a walkable, flat plane, completely ignoring both the baked navigation meshes as well as the bakesource collision geometry. It is like implementing car navigation without considering streets and adding landmines on the map for cherry.

Steps to reproduce:
Not producable without #48028 merged cause NavigationAgent3D callbacks are broken for months now.

I only just fixed the callback issue to find out that with "working" callbacks the collision avoidance calculation on the NavigationServer is a malicious agent murder machine that should be returned to its creator.

Minimal reproduction project:
Not producable without #48028 merged cause NavigationAgent3D callbacks are broken for months now.

@christinoleo
Copy link
Contributor

@smix8 thanks very much for #48028, I tried to make a fix myself but had absolute no success on understanding that code.
To add to the discussion:

  • The bake navmesh seems to ignore csg instances (configured with use_collider) when using "Static Colliders" as parsed geometry. I don't know if this is part of the new NavigationAgent or not, and if not I am happy to create a separate issue for this
  • While using multiple kinematic bodies with agents, they don't seem to avoid (e.g. path around) each other when creating the safe_velocity, which I thought was the whole purpose of safe_velocity. They merely collide and slide. This is especially noticeable with multiple agents blocking the way or an agent and walls. (note: this code is using Fix broken NavigationAgent3D collision avoidance callbacks #48028)

I don't know anymore what is expected from the navigation system and what is expected for game devs to implement due to custom behaviour, but by my tests, I unfortunately can't use it at all. Maybe I'm missing something?

This is the project I used: aoe.zip

ezgif-2-c58382452bbf

@smix8
Copy link
Contributor Author

smix8 commented Apr 21, 2021

@christinoleo
Navmesh baking issues are not directly related so better open another issue for this. I can't tell what is a bug or a feature with CSG nodes.

I had no issue after the fix to get my agents to react with collision avoidance technically and move around each other. The endresult in movement behavior is just not very usable in practice if your game is not placed in a desert on a flat plane. Maybe your agent issue is scripting related. See my post here for basic movement examples for Node3D, KinematicBody3D or RigidBody3D actors.

@christinoleo
Copy link
Contributor

Yes, I saw your examples in that post. My code is using the exact same logic as the Kinematic3D version of it. Oh well, I will wait and see if other updates fixes this behaviour in a month or so. BTW I think those codes are a great fit for documentation/tutorial, in case they aren't already in some documentation somewhere!

@smix8
Copy link
Contributor Author

smix8 commented Apr 21, 2021

They are not rightnow. I plan to add them to a documentation PR if no one beats me to it.

For an RTS like gametype like your mini demo I would work with movement formations to begin with and not rely on navmesh based collision avoidance as it always ends in a disaster movement.

@smix8
Copy link
Contributor Author

smix8 commented May 18, 2022

Closing cause there are multiple similar issues open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants