My guess is that the issue is in the _on_touch_drag
function. I believe InputEventScreenDrag
returns a local position rather than a global position. You probably need to convert the event.position
from local space to global space, using code similar to the code seen in this Godot Q&A answer:
func _on_touch_drag(event : InputEventScreenDrag):
var event_global = get_canvas_transform().affine_inverse().xform_inv(event.position)
launch_force = (rest.global_position - event_global).clamped(MAX_DISTANCE)