onready var target = $"../target".position
var total_time = 0
var amplitude = 10
draw_line(Vector2(), target - position, Color.aqua)
target.y = cos(total_time) * amplitude
total_time += delta
Suppose I have two 2D nodes ("Node2D" and "target") with a script above attached to "Node2D". They are both children of 2D node called "Main".
What I'm having trouble with is that target's y is oscillating relative to its parent (having sinusoidal peaks relative to its parent), and I want these sinusoidal peaks to be relative to target's original position that was defined in the scene if that makes sense.
How can I achieve that?