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<'_, '_>
impl ContactModificationContextView<'_, '_>
Sourcepub fn collider1(&self) -> Entity
pub fn collider1(&self) -> Entity
The entity of the first collider involved in the potential collision.
Sourcepub fn collider2(&self) -> Entity
pub fn collider2(&self) -> Entity
The entity of the second collider involved in the potential collision.
Sourcepub fn rigid_body1(&self) -> Option<Entity>
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.
Sourcepub fn rigid_body2(&self) -> Option<Entity>
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<'_, '_>
impl ContactModificationContextView<'_, '_>
Sourcepub fn is_rigid(&self) -> bool
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.
Sourcepub fn is_soft(&self) -> bool
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.
Sourcepub fn soft(&self) -> Option<&SoftPairContacts>
pub fn soft(&self) -> Option<&SoftPairContacts>
The contact candidates of a pair of two soft surfaces (None for other pairs).
Sourcepub fn soft_mut(&mut self) -> Option<&mut SoftPairContacts>
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.
Sourcepub fn manifold(&self) -> Option<&ContactManifold>
pub fn manifold(&self) -> Option<&ContactManifold>
The contact manifold being modified (None for a pair of two soft surfaces).
Sourcepub fn normal(&self) -> Option<Vect>
pub fn normal(&self) -> Option<Vect>
The world-space contact normal of the manifold (None for a pair of two soft surfaces).
Sourcepub fn set_normal(&mut self, normal: Vect)
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).
Sourcepub fn friction(&self) -> Option<Real>
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).
Sourcepub fn set_friction(&mut self, friction: Real)
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).
Sourcepub fn restitution(&self) -> Option<Real>
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).
Sourcepub fn set_restitution(&mut self, restitution: Real)
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).
Sourcepub fn user_data(&self) -> Option<u32>
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).
Sourcepub fn set_user_data(&mut self, user_data: u32)
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).
Sourcepub fn solver_contacts(&self) -> Option<&[SolverContact]>
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.
Sourcepub fn solver_contacts_mut(&mut self) -> Option<&mut SolverContacts>
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.
Sourcepub fn update_as_oneway_platform(
&mut self,
allowed_local_n1: Vect,
allowed_angle: Real,
)
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§
impl<'a, 'b> !RefUnwindSafe for ContactModificationContextView<'a, 'b>
impl<'a, 'b> !UnwindSafe for ContactModificationContextView<'a, 'b>
impl<'a, 'b> Freeze for ContactModificationContextView<'a, 'b>
impl<'a, 'b> Send for ContactModificationContextView<'a, 'b>
impl<'a, 'b> Sync for ContactModificationContextView<'a, 'b>
impl<'a, 'b> Unpin for ContactModificationContextView<'a, 'b>
impl<'a, 'b> UnsafeUnpin for ContactModificationContextView<'a, 'b>
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
impl<T> MaybeSync for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Settings for T
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.