Skip to main content

ContactModificationContextView

Struct ContactModificationContextView 

Source
pub struct ContactModificationContextView<'a, 'b> {
    pub raw: &'a mut ContactModificationContext<'b>,
}
Expand description

Read-write access to the properties of a contact modification context.

Fields§

§raw: &'a mut ContactModificationContext<'b>

The raw context from Rapier.

Implementations§

Source§

impl ContactModificationContextView<'_, '_>

Source

pub fn collider1(&self) -> Entity

The entity of the first collider involved in the potential collision.

Source

pub fn collider2(&self) -> Entity

The entity of the second collider involved in the potential collision.

Source

pub fn rigid_body1(&self) -> Option<Entity>

The entity of the first rigid-body (if self.collider1() is attached to a rigid-body) involved in the potential collision.

Source

pub fn rigid_body2(&self) -> Option<Entity>

The entity of the second rigid-body (if self.collider1() is attached to a rigid-body) involved in the potential collision.

Source§

impl ContactModificationContextView<'_, '_>

Source

pub fn is_rigid(&self) -> bool

Is this a pair with contact manifolds (every pair except two soft surfaces)?

All the manifold accessors of this view (e.g. Self::normal, Self::friction, Self::solver_contacts) are only meaningful for such pairs.

Source

pub fn is_soft(&self) -> bool

Is this a pair of two soft surfaces?

The contacts of such pairs are contact candidates rather than a manifold. They can be accessed through Self::soft and Self::soft_mut; the manifold accessors of this view return None (or do nothing) for them.

Source

pub fn soft(&self) -> Option<&SoftPairContacts>

The contact candidates of a pair of two soft surfaces (None for other pairs).

Source

pub fn soft_mut(&mut self) -> Option<&mut SoftPairContacts>

Mutable access to the contact candidates of a pair of two soft surfaces (None for other pairs).

A candidate’s dir and dist can be modified, or its enabled flag cleared to drop it; SoftPairContacts::disable_all ignores the whole pair in the constraints solver.

Source

pub fn manifold(&self) -> Option<&ContactManifold>

The contact manifold being modified (None for a pair of two soft surfaces).

Source

pub fn normal(&self) -> Option<Vect>

The world-space contact normal of the manifold (None for a pair of two soft surfaces).

Source

pub fn set_normal(&mut self, normal: Vect)

Sets the world-space contact normal of the manifold (ignored for a pair of two soft surfaces).

Source

pub fn friction(&self) -> Option<Real>

The friction coefficient applied to every solver contact of the manifold (None for a pair of two soft surfaces).

Source

pub fn set_friction(&mut self, friction: Real)

Sets the friction coefficient applied to every solver contact of the manifold (ignored for a pair of two soft surfaces).

Source

pub fn restitution(&self) -> Option<Real>

The restitution coefficient applied to every solver contact of the manifold (None for a pair of two soft surfaces).

Source

pub fn set_restitution(&mut self, restitution: Real)

Sets the restitution coefficient applied to every solver contact of the manifold (ignored for a pair of two soft surfaces).

Source

pub fn user_data(&self) -> Option<u32>

The user-defined data of the manifold, persistent across timesteps while the manifold exists (None for a pair of two soft surfaces).

Source

pub fn set_user_data(&mut self, user_data: u32)

Sets the user-defined data of the manifold (ignored for a pair of two soft surfaces).

Source

pub fn solver_contacts(&self) -> Option<&[SolverContact]>

The solver contacts of the manifold (None for a pair of two soft surfaces).

While inside the hook, each solver contact’s anchor1/anchor2 hold the world-space contact points on each body and dist their separation.

Source

pub fn solver_contacts_mut(&mut self) -> Option<&mut SolverContacts>

Mutable access to the solver contacts of the manifold (None for a pair of two soft surfaces).

Contacts can be modified (e.g. their tangent_velocity to simulate conveyor belts), removed, or all cleared to ignore this manifold in the constraints solver.

Source

pub fn update_as_oneway_platform( &mut self, allowed_local_n1: Vect, allowed_angle: Real, )

Updates the contacts to emulate a one-way platform.

Contacts are only allowed if the contact normal, expressed in the local space of the first collider, is within allowed_angle (in radians) of allowed_local_n1. This must be called at each timestep for each manifold involving the platform, and the manifold’s user data must not be modified elsewhere since it is used to track the contact state. Pairs of two soft surfaces are left untouched.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

Source§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &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)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T> MaybeSync for T
where T: Sync + ?Sized,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Settings for T
where T: 'static + Send + Sync,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more