Skip to main content

Collider

Struct Collider 

Source
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>
where N: RealField + Copy, Handle: BodyHandle,

Source

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.

Source

pub fn user_data(&self) -> Option<&(dyn Any + Send + Sync + 'static)>

The user-data attached to this collider.

Source

pub fn user_data_mut( &mut self, ) -> Option<&mut (dyn Any + Send + Sync + 'static)>

Mutable reference to the user-data attached to this collider.

Source

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.

Source

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.

Source

pub fn margin(&self) -> N

The collision margin surrounding this collider.

Source

pub fn set_margin(&mut self, margin: N)

Sets the marging on this collider’s shapes.

Source

pub fn clear_update_flags(&mut self)

Clears all the internal flags tracking changes made to this collider.

Source

pub fn density(&self) -> N

The density of this collider.

Source

pub fn body(&self) -> Handle

Handle to the body this collider is attached to.

Source

pub fn anchor(&self) -> &ColliderAnchor<N, Handle>

The anchor attaching this collider with a body part or deformable body.

Source

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.

Source

pub fn body_part(&self, subshape_id: usize) -> BodyPartHandle<Handle>

Handle to the body part containing the given subshape of this collider’s shape.

Source

pub fn material(&self) -> &(dyn Material<N> + 'static)

The material of this collider.

Source

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).

Source

pub fn is_sensor(&self) -> bool

Returns true if this collider is a sensor.

Source

pub fn is_ccd_enabled(&self) -> bool

Returns true if this collider is subjected to Continuous Collision Detection (CCD).

Source

pub fn enable_ccd(&mut self, enabled: bool)

Enables or disables Continuous Collision Detection (CCD) for this collider.

Source

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.

Source

pub fn set_graph_index(&mut self, index: Option<NodeIndex<usize>>)

Sets the collider unique but non-stable graph index.

Source

pub fn proxy_handle(&self) -> Option<BroadPhaseProxyHandle>

The collider’s broad phase proxy unique identifier.

Source

pub fn set_proxy_handle(&mut self, handle: Option<BroadPhaseProxyHandle>)

Sets the collider’s broad phase proxy unique identifier.

Source

pub fn position(&self) -> &Isometry<N, Unit<Complex<N>>, 2>

The collider position.

Source

pub fn set_position(&mut self, pos: Isometry<N, Unit<Complex<N>>, 2>)

Sets the position of the collider.

Source

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.

Source

pub fn set_deformations(&mut self, coords: &[N])

Deforms the underlying shape if possible.

Panics if the shape is not deformable.

Source

pub fn shape(&self) -> &(dyn Shape<N> + 'static)

This collider’s shape.

Source

pub fn shape_handle(&self) -> &ShapeHandle<N>

This collider’s shape.

Source

pub fn set_shape(&mut self, shape: ShapeHandle<N>)

Sets this collider’s shape.

Source

pub fn collision_groups(&self) -> &CollisionGroups

The collision groups of the collider.

Source

pub fn set_collision_groups(&mut self, groups: CollisionGroups)

Sets the collision groups of this collider.

Source

pub fn query_type(&self) -> GeometricQueryType<N>

Returns the kind of queries this collider is expected to emit.

Source

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>
where N: RealField + Copy, Handle: BodyHandle,

Source§

fn graph_index(&self) -> Option<NodeIndex<usize>>

The interaction graph index of this collision object, if it has been registered into an interaction graph. Read more
Source§

fn proxy_handle(&self) -> Option<BroadPhaseProxyHandle>

The broad-phase proxy handle of this collision object, if it has been registered into a broad-phase. Read more
Source§

fn position(&self) -> &Isometry<N, Unit<Complex<N>>, 2>

The position of this collision object.
Source§

fn predicted_position(&self) -> Option<&Isometry<N, Unit<Complex<N>>, 2>>

The expected position of this collision object in the next updates. Read more
Source§

fn shape(&self) -> &(dyn Shape<N> + 'static)

The shape of this collision object.
Source§

fn collision_groups(&self) -> &CollisionGroups

The collision groups of this collision object.
Source§

fn query_type(&self) -> GeometricQueryType<N>

The type of geometric queries this collision object is subjected to.
Source§

fn update_flags(&self) -> CollisionObjectUpdateFlags

Flags indicating what changed in this collision object.
Source§

fn compute_aabb(&self) -> AABB<N>

Computes the AABB of this collision object, ignoring self.predicted_position().
Source§

fn compute_swept_aabb(&self) -> AABB<N>

Computes the swept AABB of this collision object, taking self.predict_position() into account. Read more

Auto Trait Implementations§

§

impl<N, Handle> Freeze for Collider<N, Handle>
where N: Freeze, Handle: Freeze,

§

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>
where N: Unpin, Handle: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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<T> Downcast for T
where T: Any,

Source§

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

Convert 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>

Convert 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)

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

Convert &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
where T: Any + Send + Sync,

Source§

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

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> Finalize for T

Source§

unsafe fn finalize_raw(data: *mut ())

Safety Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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<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> Component for T
where T: Send + Sync + 'static,

Source§

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