pub struct FallingRocks {
pub spawn_positions: Vec<Vec2>,
pub trigger_zone: AABB,
pub rock_mass: f32,
pub rock_radius: f32,
pub damage: f32,
pub is_triggered: bool,
pub active_rocks: Vec<FallingRock>,
pub debris_lifetime: f32,
pub debris_timer: f32,
pub shatter_threshold_velocity: f32,
}Expand description
Falling rocks trap system.
Fields§
§spawn_positions: Vec<Vec2>§trigger_zone: AABB§rock_mass: f32§rock_radius: f32§damage: f32§is_triggered: bool§active_rocks: Vec<FallingRock>§debris_lifetime: f32§debris_timer: f32§shatter_threshold_velocity: f32Implementations§
Source§impl FallingRocks
impl FallingRocks
pub fn new(spawn_positions: Vec<Vec2>, trigger_zone: AABB, damage: f32) -> Self
Sourcepub fn trigger(&mut self, world: &mut PhysicsWorld)
pub fn trigger(&mut self, world: &mut PhysicsWorld)
Trigger the rock fall.
Sourcepub fn update(&mut self, dt: f32, world: &mut PhysicsWorld, floor_y: f32)
pub fn update(&mut self, dt: f32, world: &mut PhysicsWorld, floor_y: f32)
Update: check for floor impacts and spawn debris.
Sourcepub fn check_trigger(&self, point: Vec2) -> bool
pub fn check_trigger(&self, point: Vec2) -> bool
Check if a point is in the trigger zone.
Trait Implementations§
Source§impl Clone for FallingRocks
impl Clone for FallingRocks
Source§fn clone(&self) -> FallingRocks
fn clone(&self) -> FallingRocks
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FallingRocks
impl RefUnwindSafe for FallingRocks
impl Send for FallingRocks
impl Sync for FallingRocks
impl Unpin for FallingRocks
impl UnsafeUnpin for FallingRocks
impl UnwindSafe for FallingRocks
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,
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.