pub struct FpsCameraController {
pub position: Point3<f32>,
pub yaw: f32,
pub pitch: f32,
pub move_speed: f32,
pub min_pitch: f32,
pub max_pitch: f32,
}Expand description
First-person fly / walk camera controller.
Translates along view-aligned axes and rotates with yaw and pitch.
Fields§
§position: Point3<f32>World-space position of the camera eye.
yaw: f32Horizontal heading angle in radians.
pitch: f32Vertical look angle in radians.
move_speed: f32Movement speed units per second.
min_pitch: f32Minimum pitch angle in radians (default: ~ -89°).
max_pitch: f32Maximum pitch angle in radians (default: ~ +89°).
Implementations§
Source§impl FpsCameraController
impl FpsCameraController
Sourcepub fn new(position: Point3<f32>) -> Self
pub fn new(position: Point3<f32>) -> Self
Create a new first-person camera controller at position.
Sourcepub fn rotate(&mut self, delta_yaw: f32, delta_pitch: f32)
pub fn rotate(&mut self, delta_yaw: f32, delta_pitch: f32)
Rotate view by delta yaw and pitch (in radians).
Sourcepub fn horizontal_forward(&self) -> Vector3<f32>
pub fn horizontal_forward(&self) -> Vector3<f32>
Forward direction vector on the horizontal plane (unit length).
Sourcepub fn horizontal_right(&self) -> Vector3<f32>
pub fn horizontal_right(&self) -> Vector3<f32>
Right direction vector on the horizontal plane (unit length).
Sourcepub fn look_direction(&self) -> Vector3<f32>
pub fn look_direction(&self) -> Vector3<f32>
True look direction vector including pitch.
Sourcepub fn move_relative(
&mut self,
forward: f32,
strafe: f32,
vertical: f32,
dt: f32,
)
pub fn move_relative( &mut self, forward: f32, strafe: f32, vertical: f32, dt: f32, )
Move the camera relative to its current heading.
forward: +1 = forward, -1 = backward
strafe: +1 = right, -1 = left
vertical: +1 = up, -1 = down
Sourcepub fn update_camera(&self, camera: &mut Camera)
pub fn update_camera(&self, camera: &mut Camera)
Synchronize state to an engine Camera.
Trait Implementations§
Source§impl Clone for FpsCameraController
impl Clone for FpsCameraController
Source§fn clone(&self) -> FpsCameraController
fn clone(&self) -> FpsCameraController
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FpsCameraController
Source§impl Debug for FpsCameraController
impl Debug for FpsCameraController
Source§impl PartialEq for FpsCameraController
impl PartialEq for FpsCameraController
impl StructuralPartialEq for FpsCameraController
Auto Trait Implementations§
impl Freeze for FpsCameraController
impl RefUnwindSafe for FpsCameraController
impl Send for FpsCameraController
impl Sync for FpsCameraController
impl Unpin for FpsCameraController
impl UnsafeUnpin for FpsCameraController
impl UnwindSafe for FpsCameraController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.