pub struct Collider<N, Handle>(/* private fields */)
where
N: RealField + Copy,
Handle: BodyHandle;Expand description
A geometric entity that can be attached to a body so it can be affected by contacts and proximity queries.
Implementations§
Source§impl<N, Handle> Collider<N, Handle>
impl<N, Handle> Collider<N, Handle>
Sourcepub fn removal_data(&self) -> Option<ColliderRemovalData<N, Handle>>
pub fn removal_data(&self) -> Option<ColliderRemovalData<N, Handle>>
Computes the data that needs to be returned once this collider has been removed from a collider set.
Sourcepub fn user_data(&self) -> Option<&(dyn Any + Send + Sync + 'static)>
pub fn user_data(&self) -> Option<&(dyn Any + Send + Sync + 'static)>
The user-data attached to this collider.
Sourcepub fn user_data_mut(
&mut self,
) -> Option<&mut (dyn Any + Send + Sync + 'static)>
pub fn user_data_mut( &mut self, ) -> Option<&mut (dyn Any + Send + Sync + 'static)>
Mutable reference to the user-data attached to this collider.
Sourcepub fn set_user_data(
&mut self,
data: Option<Box<dyn Any + Send + Sync>>,
) -> Option<Box<dyn Any + Send + Sync>>
pub fn set_user_data( &mut self, data: Option<Box<dyn Any + Send + Sync>>, ) -> Option<Box<dyn Any + Send + Sync>>
Sets the user-data attached to this collider.
Sourcepub fn take_user_data(&mut self) -> Option<Box<dyn Any + Send + Sync>>
pub fn take_user_data(&mut self) -> Option<Box<dyn Any + Send + Sync>>
Replaces the user-data of this collider by None and returns the old value.
Sourcepub fn set_margin(&mut self, margin: N)
pub fn set_margin(&mut self, margin: N)
Sets the marging on this collider’s shapes.
Sourcepub fn clear_update_flags(&mut self)
pub fn clear_update_flags(&mut self)
Clears all the internal flags tracking changes made to this collider.
Sourcepub fn anchor(&self) -> &ColliderAnchor<N, Handle>
pub fn anchor(&self) -> &ColliderAnchor<N, Handle>
The anchor attaching this collider with a body part or deformable body.
Sourcepub fn position_wrt_body(&self) -> Isometry<N, Unit<Complex<N>>, 2>
pub fn position_wrt_body(&self) -> Isometry<N, Unit<Complex<N>>, 2>
The position of this collider geometry wrt. the body it is attached to.
Sourcepub fn body_part(&self, subshape_id: usize) -> BodyPartHandle<Handle>
pub fn body_part(&self, subshape_id: usize) -> BodyPartHandle<Handle>
Handle to the body part containing the given subshape of this collider’s shape.
Sourcepub fn material_mut(&mut self) -> &mut (dyn Material<N> + 'static)
pub fn material_mut(&mut self) -> &mut (dyn Material<N> + 'static)
A mutable reference to this collider’s material.
If the material is shared, then an internal clone is performed
before returning the mutable reference (this effectively calls
the Arc::make_mut method to get a copy-on-write behavior).
Sourcepub fn is_ccd_enabled(&self) -> bool
pub fn is_ccd_enabled(&self) -> bool
Returns true if this collider is subjected to Continuous Collision Detection (CCD).
Sourcepub fn enable_ccd(&mut self, enabled: bool)
pub fn enable_ccd(&mut self, enabled: bool)
Enables or disables Continuous Collision Detection (CCD) for this collider.
Sourcepub fn graph_index(&self) -> Option<NodeIndex<usize>>
pub fn graph_index(&self) -> Option<NodeIndex<usize>>
This collider’s non-stable graph index.
This index may change whenever a collider is removed from the world.
Sourcepub fn set_graph_index(&mut self, index: Option<NodeIndex<usize>>)
pub fn set_graph_index(&mut self, index: Option<NodeIndex<usize>>)
Sets the collider unique but non-stable graph index.
Sourcepub fn proxy_handle(&self) -> Option<BroadPhaseProxyHandle>
pub fn proxy_handle(&self) -> Option<BroadPhaseProxyHandle>
The collider’s broad phase proxy unique identifier.
Sourcepub fn set_proxy_handle(&mut self, handle: Option<BroadPhaseProxyHandle>)
pub fn set_proxy_handle(&mut self, handle: Option<BroadPhaseProxyHandle>)
Sets the collider’s broad phase proxy unique identifier.
Sourcepub fn set_position(&mut self, pos: Isometry<N, Unit<Complex<N>>, 2>)
pub fn set_position(&mut self, pos: Isometry<N, Unit<Complex<N>>, 2>)
Sets the position of the collider.
Sourcepub fn set_position_with_prediction(
&mut self,
position: Isometry<N, Unit<Complex<N>>, 2>,
prediction: Isometry<N, Unit<Complex<N>>, 2>,
)
pub fn set_position_with_prediction( &mut self, position: Isometry<N, Unit<Complex<N>>, 2>, prediction: Isometry<N, Unit<Complex<N>>, 2>, )
Sets the position of the collider.
Sourcepub fn set_deformations(&mut self, coords: &[N])
pub fn set_deformations(&mut self, coords: &[N])
Deforms the underlying shape if possible.
Panics if the shape is not deformable.
Sourcepub fn shape_handle(&self) -> &ShapeHandle<N>
pub fn shape_handle(&self) -> &ShapeHandle<N>
This collider’s shape.
Sourcepub fn set_shape(&mut self, shape: ShapeHandle<N>)
pub fn set_shape(&mut self, shape: ShapeHandle<N>)
Sets this collider’s shape.
Sourcepub fn collision_groups(&self) -> &CollisionGroups
pub fn collision_groups(&self) -> &CollisionGroups
The collision groups of the collider.
Sourcepub fn set_collision_groups(&mut self, groups: CollisionGroups)
pub fn set_collision_groups(&mut self, groups: CollisionGroups)
Sets the collision groups of this collider.
Sourcepub fn query_type(&self) -> GeometricQueryType<N>
pub fn query_type(&self) -> GeometricQueryType<N>
Returns the kind of queries this collider is expected to emit.
Sourcepub fn set_query_type(&mut self, query_type: GeometricQueryType<N>)
pub fn set_query_type(&mut self, query_type: GeometricQueryType<N>)
Sets the GeometricQueryType of the collider.
Use CollisionWorld::set_query_type to use this method.
Trait Implementations§
Source§impl<N, Handle> CollisionObjectRef<N> for Collider<N, Handle>
impl<N, Handle> CollisionObjectRef<N> for Collider<N, Handle>
Source§fn graph_index(&self) -> Option<NodeIndex<usize>>
fn graph_index(&self) -> Option<NodeIndex<usize>>
Source§fn proxy_handle(&self) -> Option<BroadPhaseProxyHandle>
fn proxy_handle(&self) -> Option<BroadPhaseProxyHandle>
Source§fn position(&self) -> &Isometry<N, Unit<Complex<N>>, 2>
fn position(&self) -> &Isometry<N, Unit<Complex<N>>, 2>
Source§fn predicted_position(&self) -> Option<&Isometry<N, Unit<Complex<N>>, 2>>
fn predicted_position(&self) -> Option<&Isometry<N, Unit<Complex<N>>, 2>>
Source§fn collision_groups(&self) -> &CollisionGroups
fn collision_groups(&self) -> &CollisionGroups
Source§fn query_type(&self) -> GeometricQueryType<N>
fn query_type(&self) -> GeometricQueryType<N>
Source§fn update_flags(&self) -> CollisionObjectUpdateFlags
fn update_flags(&self) -> CollisionObjectUpdateFlags
Source§fn compute_aabb(&self) -> AABB<N>
fn compute_aabb(&self) -> AABB<N>
self.predicted_position().Source§fn compute_swept_aabb(&self) -> AABB<N>
fn compute_swept_aabb(&self) -> AABB<N>
self.predict_position() into account. Read moreAuto Trait Implementations§
impl<N, Handle> Freeze for Collider<N, Handle>
impl<N, Handle> !RefUnwindSafe for Collider<N, Handle>
impl<N, Handle> Send for Collider<N, Handle>
impl<N, Handle> Sync for Collider<N, Handle>
impl<N, Handle> Unpin for Collider<N, Handle>
impl<N, Handle> UnsafeUnpin for Collider<N, Handle>where
N: UnsafeUnpin,
Handle: UnsafeUnpin,
impl<N, Handle> !UnwindSafe for Collider<N, Handle>
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> 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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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> DowncastSync for T
impl<T> DowncastSync for 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 moreSource§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.