pub trait BodyPart<N>:
Downcast
+ Send
+ Sync{
// Required methods
fn center_of_mass(&self) -> OPoint<N, Const<2>>;
fn local_center_of_mass(&self) -> OPoint<N, Const<2>>;
fn position(&self) -> Isometry<N, Unit<Complex<N>>, 2>;
fn velocity(&self) -> Velocity2<N>;
fn inertia(&self) -> Inertia2<N>;
fn local_inertia(&self) -> Inertia2<N>;
// Provided methods
fn is_ground(&self) -> bool { ... }
fn safe_position(&self) -> Isometry<N, Unit<Complex<N>>, 2> { ... }
}Expand description
Trait implemented by each part of a body supported by nphysics.
Required Methods§
Sourcefn center_of_mass(&self) -> OPoint<N, Const<2>>
fn center_of_mass(&self) -> OPoint<N, Const<2>>
The center of mass of this body part.
Sourcefn local_center_of_mass(&self) -> OPoint<N, Const<2>>
fn local_center_of_mass(&self) -> OPoint<N, Const<2>>
The local center of mass of this body part.
Sourcefn position(&self) -> Isometry<N, Unit<Complex<N>>, 2>
fn position(&self) -> Isometry<N, Unit<Complex<N>>, 2>
The position of this body part wrt. the ground.
Sourcefn local_inertia(&self) -> Inertia2<N>
fn local_inertia(&self) -> Inertia2<N>
The local-space inertia of this body part.
Provided Methods§
Sourcefn safe_position(&self) -> Isometry<N, Unit<Complex<N>>, 2>
fn safe_position(&self) -> Isometry<N, Unit<Complex<N>>, 2>
If CCD is enabled, this is the last position known to be tunnelling-free.
Implementations§
Source§impl<N> dyn BodyPart<N>
impl<N> dyn BodyPart<N>
Sourcepub fn is<__T>(&self) -> boolwhere
__T: BodyPart<N>,
pub fn is<__T>(&self) -> boolwhere
__T: BodyPart<N>,
Returns true if the trait object wraps an object of type __T.
Sourcepub fn downcast<__T>(
self: Box<dyn BodyPart<N>>,
) -> Result<Box<__T>, Box<dyn BodyPart<N>>>where
__T: BodyPart<N>,
pub fn downcast<__T>(
self: Box<dyn BodyPart<N>>,
) -> Result<Box<__T>, Box<dyn BodyPart<N>>>where
__T: BodyPart<N>,
Returns a boxed object from a boxed trait object if the underlying object is of type
__T. Returns the original boxed trait if it isn’t.
Sourcepub fn downcast_rc<__T>(
self: Rc<dyn BodyPart<N>>,
) -> Result<Rc<__T>, Rc<dyn BodyPart<N>>>where
__T: BodyPart<N>,
pub fn downcast_rc<__T>(
self: Rc<dyn BodyPart<N>>,
) -> Result<Rc<__T>, Rc<dyn BodyPart<N>>>where
__T: BodyPart<N>,
Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of
type __T. Returns the original Rc-ed trait if it isn’t.
Sourcepub fn downcast_ref<__T>(&self) -> Option<&__T>where
__T: BodyPart<N>,
pub fn downcast_ref<__T>(&self) -> Option<&__T>where
__T: BodyPart<N>,
Returns a reference to the object within the trait object if it is of type __T, or
None if it isn’t.
Sourcepub fn downcast_mut<__T>(&mut self) -> Option<&mut __T>where
__T: BodyPart<N>,
pub fn downcast_mut<__T>(&mut self) -> Option<&mut __T>where
__T: BodyPart<N>,
Returns a mutable reference to the object within the trait object if it is of type
__T, or None if it isn’t.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".