pub struct LookAngles {
pub yaw: f32,
pub pitch: f32,
}Expand description
A look direction as yaw and pitch, Z-up.
yawturns around world Z. Yaw 0 looks along +Y and increasing yaw turns toward +X (clockwise seen from above).pitchis the angle above the horizontal plane: positive looks up.
There is no roll. orientation gives the matching
Camera::orientation, and
from_orientation reads one back, dropping any
roll it carried. The first- and third-person controllers store their look
this way.
Fields§
§yaw: f32Rotation around world Z, in radians.
pitch: f32Angle above the horizontal plane, in radians.
Implementations§
Source§impl LookAngles
impl LookAngles
Sourcepub const FORWARD: LookAngles
pub const FORWARD: LookAngles
Looking along +Y, level.
Sourcepub const fn new(yaw: f32, pitch: f32) -> LookAngles
pub const fn new(yaw: f32, pitch: f32) -> LookAngles
Build from yaw and pitch in radians.
Sourcepub fn from_orientation(orientation: Quat) -> LookAngles
pub fn from_orientation(orientation: Quat) -> LookAngles
Read the look out of a camera orientation. Roll is dropped.
Looking straight up or down leaves yaw undefined; the result then takes whatever yaw the rounding gives.
Sourcepub fn from_direction(direction: Vec3) -> LookAngles
pub fn from_direction(direction: Vec3) -> LookAngles
Read the look out of a direction. A zero direction gives
FORWARD.
Sourcepub fn orientation(self) -> Quat
pub fn orientation(self) -> Quat
The camera orientation for this look.
Sourcepub fn forward(self) -> Vec3
pub fn forward(self) -> Vec3
The look direction flattened onto the ground plane, for movement. Unit length.
Sourcepub fn turned(self, yaw: f32, pitch: f32) -> LookAngles
pub fn turned(self, yaw: f32, pitch: f32) -> LookAngles
Turned by yaw and pitch radians. Pitch is not clamped; follow with
with_pitch_clamped.
Sourcepub fn with_pitch_clamped(self, min: f32, max: f32) -> LookAngles
pub fn with_pitch_clamped(self, min: f32, max: f32) -> LookAngles
With pitch held to min..=max.
Trait Implementations§
Source§impl Clone for LookAngles
impl Clone for LookAngles
Source§fn clone(&self) -> LookAngles
fn clone(&self) -> LookAngles
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more