pub struct ContactCache<const D: usize> {
pub match_threshold: f64,
/* private fields */
}Expand description
Cache of previous-frame impulses for warm-starting the contact solver.
Uses BTreeMap for deterministic iteration order (critical for replay).
Maps (body_a, body_b) → cached impulse data.
Fields§
§match_threshold: f64Proximity threshold for matching contacts across frames.
Implementations§
Source§impl<const D: usize> ContactCache<D>
impl<const D: usize> ContactCache<D>
pub fn new() -> Self
Sourcepub fn store(
&mut self,
body_a: BodyHandle,
body_b: BodyHandle,
point: SVector<f64, D>,
normal_impulse: f64,
tangent_impulse: f64,
)
pub fn store( &mut self, body_a: BodyHandle, body_b: BodyHandle, point: SVector<f64, D>, normal_impulse: f64, tangent_impulse: f64, )
Store impulses from this frame’s contact resolution.
Sourcepub fn lookup(
&self,
body_a: BodyHandle,
body_b: BodyHandle,
point: &SVector<f64, D>,
) -> Option<&CachedImpulse<D>>
pub fn lookup( &self, body_a: BodyHandle, body_b: BodyHandle, point: &SVector<f64, D>, ) -> Option<&CachedImpulse<D>>
Look up the cached impulse for a contact point from the previous frame.
Matches by body pair + proximity of contact point.
Sourcepub fn begin_frame(&mut self)
pub fn begin_frame(&mut self)
Clear all cached data (call at the start of each frame before resolving).
Sourcepub fn pair_count(&self) -> usize
pub fn pair_count(&self) -> usize
Number of cached contact pairs.
Trait Implementations§
Auto Trait Implementations§
impl<const D: usize> Freeze for ContactCache<D>
impl<const D: usize> RefUnwindSafe for ContactCache<D>
impl<const D: usize> Send for ContactCache<D>
impl<const D: usize> Sync for ContactCache<D>
impl<const D: usize> Unpin for ContactCache<D>
impl<const D: usize> UnsafeUnpin for ContactCache<D>
impl<const D: usize> UnwindSafe for ContactCache<D>
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.