Class: AngleSpring
A critically damped spring on one angle, stepped by real elapsed time.
A per-frame fraction (yaw += diff * 0.2) starts every turn at its top
speed, so a head or body whips the moment its target changes, and it runs
faster at higher frame rates. The spring starts from rest, speeds up,
then settles without overshooting: a head turn that reads as a decision
rather than a snap. omega sets the pace: about 4.7 / omega seconds to
close 95% of a turn, with a peak speed of turn * omega / e.
Constructors
constructor
• new AngleSpring(omega, wraps?): AngleSpring
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
omega | number | undefined | - |
wraps | boolean | true | Wrap the goal the short way round (yaws); off for pitches. |
Returns
Properties
omega
• omega: number
velocity
• velocity: number = 0
Radians per second.
Methods
step
▸ step(current, target, now?): number
Advance current toward target and return where it is now.
Parameters
| Name | Type |
|---|---|
current | number |
target | number |
now | number |
Returns
number
stop
▸ stop(): void
Forget the motion (a teleport, a respawn, a held pose).
Returns
void