I'm making a simple game and also learning. I'm trying to do that when thisAnimatedSprite3- Spatial node arrives to
z = -40 it should move to 40 again, like its starting point.
# Called when the node enters the scene tree for the first time.
var flySpeed = 5.0
var yAngle = 0.0
var voladorPosition = self.translation
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
if(voladorPosition.z == -40.0):
voladorPosition = 40
yAngle += 0.1
translate(Vector3(delta*flySpeed, clamp(sin(yAngle)* PI, -0.05, 0.05), 0))