pub struct MotionTracker { /* private fields */ }Expand description
Integrates gyro readings into a device orientation, as console SDKs do for
motion controllers: orientation maps the device frame into the world,
device-frame angular velocity composes on its right, and the accelerometer
is reported in the device frame alongside it.
Implementations§
Source§impl MotionTracker
impl MotionTracker
pub fn new(kind: SensorKind) -> Self
pub fn kind(&self) -> SensorKind
Sourcepub fn integrate(&mut self, sample: MotionSample, dt_seconds: f32)
pub fn integrate(&mut self, sample: MotionSample, dt_seconds: f32)
Folds one sensor reading in. A missing axis leaves its previous value, so gyro-only and accel-only devices both integrate cleanly.
pub fn orientation(&self) -> Quat
pub fn angular_velocity(&self) -> Vec3
pub fn acceleration(&self) -> Vec3
Sourcepub fn gravity(&self) -> Vec3
pub fn gravity(&self) -> Vec3
Gravity direction in the device frame: world down through the
orientation’s inverse, since orientation maps device into world.
pub fn snapshot(&self) -> MotionSnapshot
Trait Implementations§
Source§impl Clone for MotionTracker
impl Clone for MotionTracker
impl Copy for MotionTracker
Source§impl Debug for MotionTracker
impl Debug for MotionTracker
Source§impl PartialEq for MotionTracker
impl PartialEq for MotionTracker
impl StructuralPartialEq for MotionTracker
Auto Trait Implementations§
impl Freeze for MotionTracker
impl RefUnwindSafe for MotionTracker
impl Send for MotionTracker
impl Sync for MotionTracker
impl Unpin for MotionTracker
impl UnsafeUnpin for MotionTracker
impl UnwindSafe for MotionTracker
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.