how can I move an object along a path "relative" to its inital position? I want it so if the object is initially positioned "around" the path instead of in the center, it will move along the path keeping that "displacement", as the below images
The blue line is the path and the red line is what the object, in this case the zombie, would follow if it had been initially positioned in the left and right sides of the "blue path", respectively:
Hope you understood. So far I've this
func move_zombie(delta):
if target == null:
return
var target_pos = target.get_position()
var pos = get_position()
var dir = (target_pos - pos).normalized()
var zombie_speed = 200.0
position += delta * zombie_speed * dir