bevy_transform_interpolation::hermite

Function hermite_quat

source
pub fn hermite_quat(
    qa: Quat,
    qb: Quat,
    w0: Vec3,
    w1: Vec3,
    t: f32,
    unwrap: bool,
) -> Quat
Expand description

Performs a cubic Hermite interpolation between quaternions q0 and q1 with angular velocities w0 and w1 based on the value at t.

Both quaternions and angular velocities should be in the global frame. The angular velocities should be normalized such that they represent the angle of rotation over the time step.

When t is 0.0, the result will be equal to q0. When t is 1.0, the result will be equal to q1.

If unwrap is true, the interpolation will work for arbitrarily large velocities and handle multiple full revolutions correctly. This is a bit more expensive, but can be important for high angular velocities.