Skip to main content

ContactModifier

Trait ContactModifier 

Source
pub trait ContactModifier: Send + Sync {
    // Required method
    fn modify_contact(
        &self,
        body_a: usize,
        body_b: usize,
        contact: &mut Contact,
        friction: &mut Fix128,
        restitution: &mut Fix128,
    ) -> bool;
}
Expand description

Contact modification callback trait

Implement to modify contact properties before solving. More powerful than PreSolveHook: can mutate normal, depth, friction, and restitution per-contact.

Required Methods§

Source

fn modify_contact( &self, body_a: usize, body_b: usize, contact: &mut Contact, friction: &mut Fix128, restitution: &mut Fix128, ) -> bool

Modify a contact before solving.

Return false to discard the contact entirely. Modify the mutable references to change contact properties.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§