1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Shared look-basis math for the body-attached character cameras.
//!
//! Both [`crate::camera::controllers::first_person::FirstPersonCameraController`] and
//! [`crate::camera::controllers::third_person::ThirdPersonCameraController`] decompose the look direction into
//! explicit `yaw` and `pitch` angles (Z-up): yaw rotates around world Z with
//! yaw 0 looking along +Y, pitch is the angle above the horizontal plane.
use ;
/// Build the camera orientation quaternion from yaw and pitch.
///
/// At yaw 0, pitch 0 the aim is +Y (horizontal forward). Increasing pitch looks
/// up; increasing yaw rotates clockwise from above (+Y toward +X). The
/// `FRAC_PI_2 + pitch` term converts the from-horizontal pitch used here into
/// the from-overhead convention the viewport `Camera` orientation expects.
pub
/// World-space aim direction for a camera orientation (the camera looks along
/// -Z in camera space).
pub
/// Decompose an orientation into `(yaw, pitch)`, the inverse of
/// [`build_orientation`] away from the straight-up / straight-down singularities.
///
/// Used by `sync_from_camera` so switching into a character camera continues
/// from the current view rather than snapping.
pub