pub enum PhysicsEvent {
CollisionStarted {
a: BodyId,
b: BodyId,
speed: f32,
},
CollisionEnded {
a: BodyId,
b: BodyId,
},
Landed {
body: BodyId,
on: BodyId,
speed: f32,
},
Entered {
sensor: BodyId,
body: BodyId,
},
Left {
sensor: BodyId,
body: BodyId,
},
Crashed {
vehicle: BodyId,
other: BodyId,
speed: f32,
},
GearChanged {
vehicle: BodyId,
gear: i32,
},
}Expand description
Something that happened during the physics steps of this frame.
Variants§
CollisionStarted
A dynamic body started touching another solid body during a physics step.
World::move_by does not create this event; use MoveResult::hits instead.
Fields
CollisionEnded
Two solid bodies stopped touching.
Landed
A dynamic body touched the ground after being in the air. Perfect for landing sounds and fall damage.
Fields
Entered
A solid body entered a sensor.
Left
A body left a sensor.
Crashed
A vehicle drove into a solid body and lost speed.
Fields
GearChanged
A vehicle changed gear: -1 reverse, 0 neutral (engine stopped), 1 and up forward.
Implementations§
Trait Implementations§
Source§impl Clone for PhysicsEvent
impl Clone for PhysicsEvent
Source§impl Debug for PhysicsEvent
impl Debug for PhysicsEvent
Source§impl PartialEq for PhysicsEvent
impl PartialEq for PhysicsEvent
impl StructuralPartialEq for PhysicsEvent
Auto Trait Implementations§
impl Freeze for PhysicsEvent
impl RefUnwindSafe for PhysicsEvent
impl Send for PhysicsEvent
impl Sync for PhysicsEvent
impl Unpin for PhysicsEvent
impl UnsafeUnpin for PhysicsEvent
impl UnwindSafe for PhysicsEvent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<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>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> 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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.