18 lines
621 B
GDScript
18 lines
621 B
GDScript
class_name Math
|
|
|
|
static func damp(from: Variant, to: Variant, weight: float):
|
|
return lerp(from, to, 1 - exp(-weight))
|
|
|
|
static func dampf(from: float, to: float, weight: float):
|
|
return lerpf(from, to, 1 - exp(-weight))
|
|
|
|
static func damp_angle(from: float, to: float, weight: float):
|
|
return lerp_angle(from, to, 1 - exp(-weight))
|
|
|
|
static func damp_spherical(from: Vector3, to: Vector3, weight: float):
|
|
return from.slerp(to, 1 - exp(-weight))
|
|
|
|
static func from_to_rotation(from: Vector3, to: Vector3) -> Quaternion:
|
|
var axis := from.cross(to).normalized()
|
|
var angle := from.angle_to(to)
|
|
return Quaternion(axis, angle) |