godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.99k stars 21.16k forks source link

NavigationAgent2D does not avoid NavigationObstacle2D #82562

Closed coder137 closed 1 year ago

coder137 commented 1 year ago

Godot version

4.2-dev5

System information

Windows10

Issue description

NavigationAgent2D does not avoid NavigationObstacle2D (static or dynamic)

Steps to reproduce

  1. Created a dynamic obstacle (by setting the radius tab)
  2. Created a static obstacle (by adding vertices in the clockwise direction)
  3. Make 2 NavigationAgent2D agents move from point A to B, adding the obstacle in the middle
  4. Agents do not route around the obstacle
  5. This is not reproducible all the time

Minimal reproduction project

Tilemap.zip

Other issues seen with the same project

image

smix8 commented 1 year ago

Agents do not route around the obstacle

The NavigationObstacle2D has scaled visuals from the inherited Node2D scale. The actual obstacle on the navigation map created with this radius / those vertices is tiny and so it is mostly ignored by the agents.

Agents do not "route" in the sense of planning a different path around the obstacle. The obstacle pushes back the avoidance velocity of the agent.

If the navigation path points through the obstacle, because there is still navigation mesh below it, there is only so much the avoidance can do to make agents "route" around it.

coder137 commented 1 year ago

Thanks for the explanation, That makes sense. Closing this issue