I have a large number of units which follow a path like a tower defense and this all works well i am using set_pos() to have them follow the path; however i would also like them to not overlap eachother (i was thinking add an impulse when there is a collision but it does not work the way i did it) like they do currently they are rigidbody2D i am hoping there is an easy way to handle this. if i need to use a different body that works too just would like to know
thanks
Edit: just add the code im using to follow path
func update_path():
path = nav.get_simple_path(get_pos(), goal, false)
if path.size() == 0:
queue_free()
func _fixed_process(delta):
if path.size() > 1:
var d = get_pos().distance_to(path[0])
if d > 2:
set_pos(get_pos().linear_interpolate(path[0], (speed * delta)/d))
else:
path.remove(0)
else:
queue_free()