Hello, I am trying to create a 2D game with RTS style movement. I attached a NavigationAgent2D
to my unit
class. it successfully navigates around the walkable navigation layer
i created but the units can't figure out how to move around each other.
Units are meant to have collision with each other, but I want them to not get stuck behind each other. I did searching and found avoidance
as the way to get that to work and I have done the following
I also have the following code blocks
func _on_navigation_agent_2d_velocity_computed(safe_velocity):
avoidance_velocity = safe_velocity
and
if avoidance_velocity == Vector2.ZERO:
velocity = direction * move_speed
else:
velocity = avoidance_velocity
move_and_slide()
However, when avoidance is enabled it still just gets stuck, except it kind of jitters back and forth without making progress