My NavigationAgent2D
is not avoiding other agents
My
NavigationAgent2D
is not avoiding other agents even thoughavoidance_enabled
is set totrue
and I’ve adjusted theradius
andmax_speed
values accordingly.
In order to use avoidance, it’s not enough to enable the setting. You also need to write the code to do the following:
- Connect
NavigationAgent2D
’svelocity_computed
signal - Pass the desired velocity during
_physics_process()
step toNavigationAgent2D
’sset_velocity()
- Finally, use the velocity passed by the
velocity_computed
signal to actually do the movement for that physics frame.