pub struct Rotation { /* private fields */ }Expand description
Turns toward a target in whole mouse counts.
Implementations§
Source§impl Rotation
impl Rotation
Sourcepub const MAX_YAW_PER_TICK: f64 = 14.0
pub const MAX_YAW_PER_TICK: f64 = 14.0
Maximum yaw change per tick (degrees).
Sourcepub const MAX_PITCH_PER_TICK: f64 = 10.5
pub const MAX_PITCH_PER_TICK: f64 = 10.5
Maximum pitch change per tick (degrees).
Sourcepub fn new(sensitivity: f32) -> Self
pub fn new(sensitivity: f32) -> Self
A controller for an options.txt mouse sensitivity (0 … 1; vanilla default 0.5).
Sourcepub fn sensitivity(&self) -> f32
pub fn sensitivity(&self) -> f32
The sensitivity.
Sourcepub fn reset(&mut self, yaw: f32, pitch: f32)
pub fn reset(&mut self, yaw: f32, pitch: f32)
Forgets carried budgets and aims at the current look.
Sourcepub fn set_target(&mut self, yaw: f32, pitch: f32)
pub fn set_target(&mut self, yaw: f32, pitch: f32)
Sets the target (pitch clamped to ±89.5).
Sourcepub fn step(&mut self, yaw: f32, pitch: f32) -> (f32, f32)
pub fn step(&mut self, yaw: f32, pitch: f32) -> (f32, f32)
One tick: the new (yaw, pitch) from the current one.
Entity.increaseTransforms(dx * m, dy * m): yaw = (float)(yaw + dx * 0.15),
pitch = (float)(pitch - dy * 0.15), pitch clamped to ±90.
Sourcepub fn pitch_error(&self, pitch: f32) -> f32
pub fn pitch_error(&self, pitch: f32) -> f32
Remaining pitch error to the target.
Trait Implementations§
impl Copy for Rotation
impl StructuralPartialEq for Rotation
Auto Trait Implementations§
impl Forget for Rotation
impl Freeze for Rotation
impl RefUnwindSafe for Rotation
impl Send for Rotation
impl Sync for Rotation
impl Unpin for Rotation
impl UnsafeUnpin for Rotation
impl UnwindSafe for Rotation
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
Mutably borrows from an owned value. Read more