Trait QuatExt

Source
pub trait QuatExt: Sized {
    // Required methods
    fn rotate_negative_z_towards(forward: Vec3, up: Vec3) -> Option<Quat>;
    fn rotate_positive_z_towards(forward: Vec3, up: Vec3) -> Option<Quat>;
}
Expand description

Extensions to Quat

Required Methods§

Source

fn rotate_negative_z_towards(forward: Vec3, up: Vec3) -> Option<Quat>

Return a Quaternion that rotates -Z to the forward direction, using up to control roll, so that +Y will approximately point in the up direction.

Will return None if either argument is zero, non-finite, or if they are colinear.

This is generally what you want to use to construct a view-rotation when -Z is forward and +Y is up (this is what Ark uses!).

Source

fn rotate_positive_z_towards(forward: Vec3, up: Vec3) -> Option<Quat>

Return a Quaternion that rotates +Z to the forward direction, using up to control roll, so that +Y will approximately point in the up direction.

Will return None if either argument is zero, non-finite, or if they are colinear.

This is generally what you want to use to construct a view-rotation when +Z is forward and +Y is up.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§