I have a noobish question about moving a KinematicBody2D downwards via sine-wave - like a leaf dropping.
Here's the code I have:
func _physics_process(delta):
time += delta
var freq = 5
var amplitude = 150
var v = Vector2(0, 25)
v.x = sin(time * freq) * amplitude
velocity = v
var collision = move_and_collide(velocity * delta)
...
This almost works as intended. However, the "leaf drop" isn't centered relative to the node's x-position. It currently goes to the right side of the vertical axis, and bounces back to the "origin" (node's x-position). I'm having surprisingly difficult time to center this... I feel like I'm missing something obvious. I suspect I need to subtract something inside the sine-function, but my attempts have failed.