Skip to main content

CameraController

Struct CameraController 

Source
pub struct CameraController {
    pub free_fly: bool,
    pub move_speed: f32,
    pub sprint_multiplier: f32,
    pub mouse_sensitivity: f32,
    pub player_radius: f32,
    pub bounds_min: [f32; 3],
    pub bounds_max: [f32; 3],
    pub follow: Option<FollowController>,
}
Expand description

First-person / fly-through controller settings carried on a Camera3D.

A Camera3D whose controller is set (the default) is driven each frame by the internal camera controller, which turns mouse/keyboard input into a camera orientation and a movement intent. Set controller to null for a camera driven by something else (a CameraShot / Scene cutscene).

Fields§

§free_fly: bool

Direct 6-DoF flight mode. WASD moves along the camera’s full forward vector (yaw + pitch) and jump rises along world +Y; the controller writes the new position straight onto Camera3D, bypassing the physics step and the bounds box. Used for inspector / fly-through cameras (the default, e.g. the cn add foo.glb scaffold). Set false for the FPS-style ground walker.

§move_speed: f32

Walk / fly speed in world units per second.

§sprint_multiplier: f32

Sprint multiplier applied when the sprint key is held.

§mouse_sensitivity: f32

Mouse look sensitivity in radians per pixel.

§player_radius: f32

Margin kept between the camera and the bounds box (world units).

§bounds_min: [f32; 3]

AABB minimum corner the camera centre must stay inside [x, y, z].

§bounds_max: [f32; 3]

AABB maximum corner the camera centre must stay inside [x, y, z].

§follow: Option<FollowController>

Third-person follow settings; see FollowController. When set, the camera orbits the followed character and WASD steers the character instead of the camera (free_fly and the bounds box are ignored). null (the default) keeps the first-person / fly modes.

Trait Implementations§

Source§

impl Clone for CameraController

Source§

fn clone(&self) -> CameraController

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 CameraController

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for CameraController

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for CameraController

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CameraController

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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, <T as TryFrom<U>>::Error>

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.