pub struct SpikePit {
pub trigger_zone: AABB,
pub spike_positions: Vec<Vec2>,
pub spike_heights: Vec<f32>,
pub spike_velocities: Vec<f32>,
pub target_height: f32,
pub spring_constant: f32,
pub spring_damping: f32,
pub damage_per_second: f32,
pub is_active: bool,
pub object_ids: Vec<ObjectId>,
}Expand description
Spike pit trap.
Fields§
§trigger_zone: AABB§spike_positions: Vec<Vec2>§spike_heights: Vec<f32>§spike_velocities: Vec<f32>§target_height: f32§spring_constant: f32§spring_damping: f32§damage_per_second: f32§is_active: bool§object_ids: Vec<ObjectId>Implementations§
Source§impl SpikePit
impl SpikePit
pub fn new( trigger_zone: AABB, spike_count: usize, target_height: f32, damage: f32, ) -> Self
Sourcepub fn update(&mut self, dt: f32, world: &mut PhysicsWorld)
pub fn update(&mut self, dt: f32, world: &mut PhysicsWorld)
Update spike physics (spring-damper system with overshoot).
Sourcepub fn spawn(&mut self, world: &mut PhysicsWorld)
pub fn spawn(&mut self, world: &mut PhysicsWorld)
Spawn spike physics objects.
Sourcepub fn check_trigger(&self, point: Vec2) -> bool
pub fn check_trigger(&self, point: Vec2) -> bool
Check if a point triggers the spikes.
Sourcepub fn is_touching_spike(&self, point: Vec2, spike_radius: f32) -> bool
pub fn is_touching_spike(&self, point: Vec2, spike_radius: f32) -> bool
Check if a point is touching any risen spike.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpikePit
impl RefUnwindSafe for SpikePit
impl Send for SpikePit
impl Sync for SpikePit
impl Unpin for SpikePit
impl UnsafeUnpin for SpikePit
impl UnwindSafe for SpikePit
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.