pub struct ContactCache {
pub manifolds: Vec<ContactManifold>,
pub max_stale_frames: u32,
pub warm_start_factor: Fix128,
/* private fields */
}Expand description
Contact cache: stores all active manifolds across frames
Fields§
§manifolds: Vec<ContactManifold>All active manifolds
max_stale_frames: u32Maximum stale frames before manifold is removed
warm_start_factor: Fix128Warm starting factor (0.0 = off, 1.0 = full warm start)
Implementations§
Source§impl ContactCache
impl ContactCache
Sourcepub fn get_or_create(
&mut self,
pair: BodyPairKey,
friction: Fix128,
restitution: Fix128,
) -> &mut ContactManifold
pub fn get_or_create( &mut self, pair: BodyPairKey, friction: Fix128, restitution: Fix128, ) -> &mut ContactManifold
Find or create manifold for a body pair
§Panics
Panics if the internal manifold Vec is empty after a push (should never happen).
Sourcepub fn find(&self, pair: &BodyPairKey) -> Option<&ContactManifold>
pub fn find(&self, pair: &BodyPairKey) -> Option<&ContactManifold>
Find manifold for a body pair (read-only)
manifolds is pub, so an external clear()/retain()/remove()
on it can leave the private pair_index pointing past the end or at
another pair’s slot; the slot is checked, so a stale index neither
panics nor answers another pair.
Sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
Mark all manifolds as potentially stale (call at start of frame)
Sourcepub fn manifold_count(&self) -> usize
pub fn manifold_count(&self) -> usize
Total number of active manifolds
Sourcepub fn total_contact_points(&self) -> usize
pub fn total_contact_points(&self) -> usize
Total number of active contact points across all manifolds
Sourcepub fn apply_warm_start(&self, bodies: &mut [RigidBody])
pub fn apply_warm_start(&self, bodies: &mut [RigidBody])
Apply warm starting impulses to bodies
Pre-applies accumulated impulses from the previous frame’s solution,
scaled by warm_start_factor. This dramatically improves convergence.
Trait Implementations§
Source§impl Debug for ContactCache
impl Debug for ContactCache
Auto Trait Implementations§
impl Freeze for ContactCache
impl RefUnwindSafe for ContactCache
impl Send for ContactCache
impl Sync for ContactCache
impl Unpin for ContactCache
impl UnsafeUnpin for ContactCache
impl UnwindSafe for ContactCache
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