Struct ncollide2d::pipeline::object::CollisionObject
source · [−]Expand description
A stand-alone object that has a position and a shape.
Implementations
sourceimpl<N: RealField + Copy, T> CollisionObject<N, T>
impl<N: RealField + Copy, T> CollisionObject<N, T>
sourcepub fn new(
proxy_handle: Option<BroadPhaseProxyHandle>,
graph_index: Option<CollisionObjectGraphIndex>,
position: Isometry<N>,
shape: ShapeHandle<N>,
groups: CollisionGroups,
query_type: GeometricQueryType<N>,
data: T
) -> CollisionObject<N, T>
pub fn new(
proxy_handle: Option<BroadPhaseProxyHandle>,
graph_index: Option<CollisionObjectGraphIndex>,
position: Isometry<N>,
shape: ShapeHandle<N>,
groups: CollisionGroups,
query_type: GeometricQueryType<N>,
data: T
) -> CollisionObject<N, T>
Creates a new collision object.
sourcepub fn graph_index(&self) -> Option<CollisionObjectGraphIndex>
pub fn graph_index(&self) -> Option<CollisionObjectGraphIndex>
The collision object non-stable graph index.
This index may change whenever a collision object is removed from the world.
sourcepub fn set_graph_index(&mut self, index: Option<CollisionObjectGraphIndex>)
pub fn set_graph_index(&mut self, index: Option<CollisionObjectGraphIndex>)
Sets the collision object unique but non-stable graph index.
sourcepub fn update_flags_mut(&mut self) -> &mut CollisionObjectUpdateFlags
pub fn update_flags_mut(&mut self) -> &mut CollisionObjectUpdateFlags
Mutable reference to this collision object’s update flags.
sourcepub fn clear_update_flags(&mut self)
pub fn clear_update_flags(&mut self)
Clears the update flags of this collision object.
sourcepub fn proxy_handle(&self) -> Option<BroadPhaseProxyHandle>
pub fn proxy_handle(&self) -> Option<BroadPhaseProxyHandle>
The collision object’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>)
Set collision object’s broad phase proxy unique identifier.
sourcepub fn predicted_position(&self) -> Option<&Isometry<N>>
pub fn predicted_position(&self) -> Option<&Isometry<N>>
The predicted collision object position.
sourcepub fn set_position(&mut self, pos: Isometry<N>)
pub fn set_position(&mut self, pos: Isometry<N>)
Sets the position of the collision object and resets the predicted position to None.
sourcepub fn set_position_with_prediction(
&mut self,
pos: Isometry<N>,
prediction: Isometry<N>
)
pub fn set_position_with_prediction(
&mut self,
pos: Isometry<N>,
prediction: Isometry<N>
)
Sets the position of the collision object and resets the predicted position.
sourcepub fn set_predicted_position(&mut self, pos: Option<Isometry<N>>)
pub fn set_predicted_position(&mut self, pos: Option<Isometry<N>>)
Sets the predicted position of the collision object.
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(&self) -> &ShapeHandle<N>
pub fn shape(&self) -> &ShapeHandle<N>
The collision object shape.
sourcepub fn set_shape(&mut self, shape: ShapeHandle<N>)
pub fn set_shape(&mut self, shape: ShapeHandle<N>)
Set the collision object shape.
sourcepub fn collision_groups(&self) -> &CollisionGroups
pub fn collision_groups(&self) -> &CollisionGroups
The collision groups of the collision object.
sourcepub fn set_collision_groups(&mut self, groups: CollisionGroups)
pub fn set_collision_groups(&mut self, groups: CollisionGroups)
Sets the collision groups of this collision object.
sourcepub fn query_type(&self) -> GeometricQueryType<N>
pub fn query_type(&self) -> GeometricQueryType<N>
The kind of queries this collision object is expected to .
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 collision object.
Use CollisionWorld::set_query_type
to use this method.
Trait Implementations
sourceimpl<N: RealField + Copy, T> CollisionObjectRef<N> for CollisionObject<N, T>
impl<N: RealField + Copy, T> CollisionObjectRef<N> for CollisionObject<N, T>
sourcefn graph_index(&self) -> Option<CollisionObjectGraphIndex>
fn graph_index(&self) -> Option<CollisionObjectGraphIndex>
The interaction graph index of this collision object, if it has been registered into an interaction graph. Read more
sourcefn proxy_handle(&self) -> Option<BroadPhaseProxyHandle>
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
sourcefn predicted_position(&self) -> Option<&Isometry<N>>
fn predicted_position(&self) -> Option<&Isometry<N>>
The expected position of this collision object in the next updates. Read more
sourcefn collision_groups(&self) -> &CollisionGroups
fn collision_groups(&self) -> &CollisionGroups
The collision groups of this collision object.
sourcefn query_type(&self) -> GeometricQueryType<N>
fn query_type(&self) -> GeometricQueryType<N>
The type of geometric queries this collision object is subjected to.
sourcefn update_flags(&self) -> CollisionObjectUpdateFlags
fn update_flags(&self) -> CollisionObjectUpdateFlags
Flags indicating what changed in this collision object.
sourcefn compute_aabb(&self) -> AABB<N>
fn compute_aabb(&self) -> AABB<N>
Computes the AABB of this collision object, ignoring self.predicted_position()
.
sourcefn compute_swept_aabb(&self) -> AABB<N>
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, T> !RefUnwindSafe for CollisionObject<N, T>
impl<N, T> Send for CollisionObject<N, T> where
T: Send,
impl<N, T> Sync for CollisionObject<N, T> where
T: Sync,
impl<N, T> Unpin for CollisionObject<N, T> where
N: Unpin,
T: Unpin,
impl<N, T> !UnwindSafe for CollisionObject<N, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
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. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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. Read more
sourceimpl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> DowncastSync for T where
T: Any + Send + Sync,
sourceimpl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
sourcefn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
OverflowingCasts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
sourcefn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
sourcefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
sourcefn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
sourcefn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
UnwrappedCasts the value.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
WrappingCasts the value.