TurnInertia

public final class TurnInertia

Turns a model's facing toward a target yaw with inertia: an angular velocity that may change by a limited acceleration per tick, up to a speed cap. It spins up, cruises, and brakes onto the target without overshooting. Both limits fall with the model's size: the cap by its square root, the acceleration by the size itself.

Constructors

Link copied to clipboard
public void TurnInertia()

Properties

Link copied to clipboard
public float yaw

Functions

Link copied to clipboard
public float getYaw()
The current yaw in degrees, in [-180, 180), or NaN before the first step or reset.
Link copied to clipboard
public void reset(float target)
Faces target at once and drops any turning speed.
Link copied to clipboard
public float step(float target, double size, double speedCap, double acceleration)
Advances one tick toward target.
Link copied to clipboard
public static double wrap(double degrees)
Wraps degrees to [-180, 180).