pub struct EventCollector { /* private fields */ }Expand description
Manages physics events for one simulation step
Implementations§
Source§impl EventCollector
impl EventCollector
Sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
Begin a new frame: swap previous/current pair tracking
Sourcepub fn report_contact(
&mut self,
body_a: usize,
body_b: usize,
normal: Vec3Fix,
point: Vec3Fix,
depth: Fix128,
relative_velocity: Fix128,
)
pub fn report_contact( &mut self, body_a: usize, body_b: usize, normal: Vec3Fix, point: Vec3Fix, depth: Fix128, relative_velocity: Fix128, )
Report a contact between two bodies
normal points from body_b toward body_a as given here. The event
stores the pair as (min, max); when that swaps the bodies the normal
is negated so it still points from the event’s body_b toward its
body_a. relative_velocity ((v_a − v_b) · normal) and depth are
unchanged by the swap.
Sourcepub fn report_trigger(&mut self, trigger_body: usize, other_body: usize)
pub fn report_trigger(&mut self, trigger_body: usize, other_body: usize)
Report a trigger overlap
Sourcepub fn end_frame(&mut self)
pub fn end_frame(&mut self)
Finalize frame: generate End events for contacts/triggers that stopped
Sourcepub fn contact_events(&self) -> &[ContactEvent]
pub fn contact_events(&self) -> &[ContactEvent]
Get all contact events for this frame
Sourcepub fn trigger_events(&self) -> &[TriggerEvent]
pub fn trigger_events(&self) -> &[TriggerEvent]
Get all trigger events for this frame
Sourcepub fn joint_break_events(&self) -> &[JointBreakEvent]
pub fn joint_break_events(&self) -> &[JointBreakEvent]
Get the joints broken this frame, in the order they were removed (substep by substep; within one substep from the highest index down)
Sourcepub fn drain_joint_break_events(&mut self) -> Vec<JointBreakEvent>
pub fn drain_joint_break_events(&mut self) -> Vec<JointBreakEvent>
Drain joint break events (consumes them)
Sourcepub fn drain_contact_events(&mut self) -> Vec<ContactEvent>
pub fn drain_contact_events(&mut self) -> Vec<ContactEvent>
Drain contact events (consumes them)
Sourcepub fn drain_trigger_events(&mut self) -> Vec<TriggerEvent>
pub fn drain_trigger_events(&mut self) -> Vec<TriggerEvent>
Drain trigger events (consumes them)
Sourcepub fn has_events(&self) -> bool
pub fn has_events(&self) -> bool
Check if there are any events this frame
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventCollector
impl RefUnwindSafe for EventCollector
impl Send for EventCollector
impl Sync for EventCollector
impl Unpin for EventCollector
impl UnsafeUnpin for EventCollector
impl UnwindSafe for EventCollector
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more