Skip to main content

BodyPart

Trait BodyPart 

Source
pub trait BodyPart<N>:
    Downcast
    + Send
    + Sync
where N: RealField + Copy,
{ // 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§

Source

fn center_of_mass(&self) -> OPoint<N, Const<2>>

The center of mass of this body part.

Source

fn local_center_of_mass(&self) -> OPoint<N, Const<2>>

The local center of mass of this body part.

Source

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

The position of this body part wrt. the ground.

Source

fn velocity(&self) -> Velocity2<N>

The velocity of this body part.

Source

fn inertia(&self) -> Inertia2<N>

The world-space inertia of this body part.

Source

fn local_inertia(&self) -> Inertia2<N>

The local-space inertia of this body part.

Provided Methods§

Source

fn is_ground(&self) -> bool

Returns true if this body part is the ground.

Source

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>
where N: Any + 'static + RealField + Copy,

Source

pub fn is<__T>(&self) -> bool
where __T: BodyPart<N>,

Returns true if the trait object wraps an object of type __T.

Source

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.

Source

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.

Source

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.

Source

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

Implementors§

Source§

impl<N> BodyPart<N> for Ground<N>
where N: RealField + Copy,

Source§

impl<N> BodyPart<N> for MultibodyLink<N>
where N: RealField + Copy,

Source§

impl<N> BodyPart<N> for RigidBody<N>
where N: RealField + Copy,