First-Person/scenes/load/game.gd
2025-12-06 15:43:53 +09:00

14 lines
499 B
GDScript

extends Node
func lerp_toward(current, target, speed: float, delta: float):
return current + (target - current) * (1.0 - exp(-speed * delta))
func lerp_toward_angle(current: float, target: float, speed: float, delta: float) -> float:
var difference = wrapf(target - current, -PI, PI)
return current + difference * (1.0 - exp(-speed * delta))
func move_toward_angle(from : float, to: float, delta : float):
var ans = fposmod(to - from, TAU)
if ans > PI: ans -= TAU
return from + ans * delta