I do something similar, I have a simple "chain lightning effect that makes a line move between objects. This is the draw method (3.0). I move the object towards the object. This draws a line from where the object is to the other object.
func _draw():
var from = _origin_pos - get_global_position()
var to = Vector2(0, 0)
from = from.normalized() * 100
to = to.normalized() * 100
# blue
draw_line(from, to , Color(0, 0, 1), 5)
# white
draw_line(from, to, Color(1, 1, 1), 1)
And this is how I move the object toward its destination. I call this from _process()
but should be fine in _process_physics
...actually maybe that's where it SHOULD be.
func _move_towards_target(delta):
# _wr_target_obj is a weak reference to the object I'm trying to
# move towards.
var target_obj = _wr_target_obj.get_ref()
var _target_pos = target_obj.get_global_position()
var pos = get_global_position()
var dist_to = get_global_position().distance_to(_target_pos)
var movement = _target_pos - pos
movement = movement.normalized()
movement = movement * delta * CHAIN_SPEED
move_and_collide(movement)