Skip to main content

CameraRig3D

Struct CameraRig3D 

Source
pub struct CameraRig3D { /* private fields */ }
Expand description

Production 3D game camera rig supporting Spring-Arm, Orbit, First-Person, Catmull-Rom Spline, and Perlin Trauma Shake.

Implementations§

Source§

impl CameraRig3D

Spring-Arm, Orbit, First-Person, Catmull-Rom Spline Rail, and Perlin Trauma Shake for CameraRig3D.

Source

pub fn new(config: CameraRigConfig, seed: u64) -> Self

Creates a new CameraRig3D from config and deterministic Perlin shake seed.

§Arguments
  • CameraRigConfig - Camera rig settings.
  • u64 - Seed for deterministic Perlin trauma shake.
§Returns
  • Self - Initialized camera rig.
Source

pub fn apply_look_delta(&mut self, delta_yaw: f32, delta_pitch: f32)

Applies yaw and pitch input deltas in radians, clamping pitch inside configured limits.

§Arguments
  • f32 - Horizontal yaw delta in radians.
  • f32 - Vertical pitch delta in radians.
Source

pub fn add_trauma(&mut self, amount: f32)

Adds impact trauma clamped into [0.0, 1.0] to trigger smooth Perlin camera shake.

§Arguments
  • f32 - Non-negative trauma impulse.
Source

pub fn sample_spline(&self, t: f32) -> Option<CameraSplinePoint>

Evaluates the Catmull-Rom cinematic spline rail at normalized parameter t in [0.0, 1.0].

§Arguments
  • f32 - Normalized spline progress in [0.0, 1.0].
§Returns
  • Option<CameraSplinePoint> - Interpolated eye position, look target, and FOV.
Source

pub fn update( &mut self, dt: f32, follow_target: Vec3, obstacles: &[AxisAlignedBox3D], ) -> CameraRigState

Updates the camera rig for frame step dt, resolving spring-arm obstacles and Perlin trauma shake.

§Arguments
  • f32 - Frame delta time in seconds.
  • Vec3 - Followed subject anchor position in world space.
  • &[AxisAlignedBox3D] - World geometry obstacles for spring-arm ray pullback.
§Returns
  • CameraRigState - Updated world-space camera pose for this frame.
Source§

impl CameraRig3D

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_config(&self) -> CameraRigConfig

Source

pub fn get_mut_config(&mut self) -> &mut CameraRigConfig

Source

pub fn set_config(&mut self, val: CameraRigConfig) -> &mut Self

Source

pub fn get_desired_yaw(&self) -> f32

Source

pub fn get_mut_desired_yaw(&mut self) -> &mut f32

Source

pub fn set_desired_yaw(&mut self, val: f32) -> &mut Self

Source

pub fn get_desired_pitch(&self) -> f32

Source

pub fn get_mut_desired_pitch(&mut self) -> &mut f32

Source

pub fn set_desired_pitch(&mut self, val: f32) -> &mut Self

Source

pub fn get_smooth_position(&self) -> Vec3

Source

pub fn get_mut_smooth_position(&mut self) -> &mut Vec3

Source

pub fn set_smooth_position(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_smooth_target(&self) -> Vec3

Source

pub fn get_mut_smooth_target(&mut self) -> &mut Vec3

Source

pub fn set_smooth_target(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_smooth_yaw(&self) -> f32

Source

pub fn get_mut_smooth_yaw(&mut self) -> &mut f32

Source

pub fn set_smooth_yaw(&mut self, val: f32) -> &mut Self

Source

pub fn get_smooth_pitch(&self) -> f32

Source

pub fn get_mut_smooth_pitch(&mut self) -> &mut f32

Source

pub fn set_smooth_pitch(&mut self, val: f32) -> &mut Self

Source

pub fn get_smooth_fov_deg(&self) -> f32

Source

pub fn get_mut_smooth_fov_deg(&mut self) -> &mut f32

Source

pub fn set_smooth_fov_deg(&mut self, val: f32) -> &mut Self

Source

pub fn get_current_arm_length(&self) -> f32

Source

pub fn get_mut_current_arm_length(&mut self) -> &mut f32

Source

pub fn set_current_arm_length(&mut self, val: f32) -> &mut Self

Source

pub fn get_trauma(&self) -> f32

Source

pub fn get_mut_trauma(&mut self) -> &mut f32

Source

pub fn set_trauma(&mut self, val: f32) -> &mut Self

Source

pub fn get_shake_clock(&self) -> f32

Source

pub fn get_mut_shake_clock(&mut self) -> &mut f32

Source

pub fn set_shake_clock(&mut self, val: f32) -> &mut Self

Source

pub fn get_spline_t(&self) -> f32

Source

pub fn get_mut_spline_t(&mut self) -> &mut f32

Source

pub fn set_spline_t(&mut self, val: f32) -> &mut Self

Source

pub fn get_spline_points(&self) -> &Vec<CameraSplinePoint>

Source

pub fn get_mut_spline_points(&mut self) -> &mut Vec<CameraSplinePoint>

Source

pub fn set_spline_points(&mut self, val: Vec<CameraSplinePoint>) -> &mut Self

Source

pub fn get_state(&self) -> CameraRigState

Source

pub fn get_mut_state(&mut self) -> &mut CameraRigState

Source

pub fn set_state(&mut self, val: CameraRigState) -> &mut Self

Trait Implementations§

Source§

impl Clone for CameraRig3D

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CameraRig3D

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for CameraRig3D

§

impl Freeze for CameraRig3D

§

impl Move for CameraRig3D

§

impl RefUnwindSafe for CameraRig3D

§

impl Send for CameraRig3D
where RawVecInner: Send,

§

impl Sync for CameraRig3D
where RawVecInner: Sync,

§

impl Unpin for CameraRig3D
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for CameraRig3D

§

impl UnwindSafe for CameraRig3D
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.