Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | didj |
Hi, I am trying to use NavigationObstacle2D
to avoid moving obstacles, but I can’t make it work.
I am using Navigation2DServer
and a NavigationAgent2D
like so:
path = Navigation2DServer.map_get_path( navigation_agent.get_navigation_map(), global_position, target_position, true )
This works perfectly with the static obstacles (using a TileMap
), but it does not take into account my moving obstacle, which has a child NavigationObstacle2D
.
I have tried several things:
- Manually specifying the radius of the obstacle
- Using the following fix in the
_ready
function of my obstacles:Navigation2DServer.agent_set_map(nav_obstacle.get_rid(), get_world_2d().get_navigation_map())
- ticking “Avoidance enabled” in the
NavigationAgent2D
- putting everything under a
Navigation2D
node
None of this worked.
Does anyone have a clue or an example to provide?