[][src]Trait oxygengine_physics_2d::prelude::BodyPart

pub trait BodyPart<N>: Send + Sync + Downcast where
    N: RealField
{ fn center_of_mass(&self) -> Point<N, U2>;
fn local_center_of_mass(&self) -> Point<N, U2>;
fn position(&self) -> Isometry<N, U2, Unit<Complex<N>>>;
fn velocity(&self) -> Velocity2<N>;
fn inertia(&self) -> Inertia2<N>;
fn local_inertia(&self) -> Inertia2<N>; fn is_ground(&self) -> bool { ... }
fn safe_position(&self) -> Isometry<N, U2, Unit<Complex<N>>> { ... } }

Trait implemented by each part of a body supported by nphysics.

Required methods

fn center_of_mass(&self) -> Point<N, U2>

The center of mass of this body part.

fn local_center_of_mass(&self) -> Point<N, U2>

The local center of mass of this body part.

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

The position of this body part wrt. the ground.

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

The velocity of this body part.

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

The world-space inertia of this body part.

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

The local-space inertia of this body part.

Loading content...

Provided methods

fn is_ground(&self) -> bool

Returns true if this body part is the ground.

fn safe_position(&self) -> Isometry<N, U2, Unit<Complex<N>>>

If CCD is enabled, this is the last position known to be tunnelling-free.

Loading content...

Implementations

impl<N> dyn BodyPart<N> + 'static where
    N: Any + 'static + RealField

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

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

pub fn downcast<__T>(
    self: Box<dyn BodyPart<N> + 'static>
) -> Result<Box<__T>, Box<dyn BodyPart<N> + 'static>> 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.

pub fn downcast_rc<__T>(
    self: Rc<dyn BodyPart<N> + 'static>
) -> Result<Rc<__T>, Rc<dyn BodyPart<N> + 'static>> 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.

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.

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.

Implementors

impl<N> BodyPart<N> for Ground<N> where
    N: RealField
[src]

impl<N> BodyPart<N> for MultibodyLink<N> where
    N: RealField
[src]

impl<N> BodyPart<N> for RigidBody<N> where
    N: RealField
[src]

Loading content...