extends Node3D ## Subtle walk / idle motion for avatar roots. @export var idle_amp := 0.018 @export var walk_amp := 0.055 @export var speed := 7.0 var _phase := 0.0 var _moving := false var _base_y := 0.0 func _ready() -> void: _base_y = position.y _phase = randf() * TAU func set_moving(v: bool) -> void: _moving = v func _process(delta: float) -> void: _phase += delta * (speed if _moving else speed * 0.45) var amp := walk_amp if _moving else idle_amp position.y = _base_y + sin(_phase) * amp rotation.z = sin(_phase * 0.5) * (0.04 if _moving else 0.012)