pub struct RigidBodyDesc<N>where
    N: RealField + Copy,{ /* private fields */ }
Expand description

The description of a rigid body, used to build a new RigidBody.

This is the structure to use in order to create and add a rigid body (as well as some attached colliders) to the World. It follows the builder pattern and defines three kinds of methods:

  • Methods with the .with_ prefix: sets a property of self and returns Self itself.
  • Methods with the .set_prefix: sets a property of &mut self and retuns the &mut self pointer.
  • The build method: actually build the rigid body into the given World and returns a mutable reference to the newly created rigid body. The build methods takes self by-ref so the same RigidBodyDesc can be re-used (possibly modified) to build other rigid bodies.

The .with_ methods as well as the .set_ method are designed to support chaining. Because the .with_ methods takes self by-move, it is useful to use when initializing the RigidBodyDesc for the first time. The .set_ methods are useful when modifying it after this initialization (including after calls to .build).

Implementations§

source§

impl<'a, N> RigidBodyDesc<N>where N: RealField + Copy,

source

pub fn new() -> RigidBodyDesc<N>

A default rigid body builder.

source

pub fn user_data(self, data: impl UserData) -> RigidBodyDesc<N>

Sets a user-data to be attached to the object being built.

source

pub fn set_user_data( &mut self, data: Option<impl UserData> ) -> &mut RigidBodyDesc<N>

Sets the user-data to be attached to the object being built.

source

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

Reference to the user-data to be attached to the object being built.

source

pub fn rotation(self, angle: N) -> RigidBodyDesc<N>

source

pub fn set_rotation(&mut self, angle: N) -> &mut RigidBodyDesc<N>

source

pub fn kinematic_rotations(self, is_kinematic: bool) -> RigidBodyDesc<N>

source

pub fn set_rotations_kinematic( &mut self, is_kinematic: bool ) -> &mut RigidBodyDesc<N>

source

pub fn angular_inertia(self, angular_inertia: N) -> RigidBodyDesc<N>

source

pub fn set_angular_inertia( &mut self, angular_inertia: N ) -> &mut RigidBodyDesc<N>

source

pub fn translation( self, vector: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>> ) -> RigidBodyDesc<N>

source

pub fn set_translation( &mut self, vector: Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>> ) -> &mut RigidBodyDesc<N>

source

pub fn mass(self, mass: N) -> RigidBodyDesc<N>

source

pub fn set_mass(&mut self, mass: N) -> &mut RigidBodyDesc<N>

source

pub fn gravity_enabled(self, gravity_enabled: bool) -> RigidBodyDesc<N>

source

pub fn enable_gravity(&mut self, gravity_enabled: bool) -> &mut RigidBodyDesc<N>

source

pub fn linear_motion_interpolation_enabled( self, linear_motion_interpolation_enabled: bool ) -> RigidBodyDesc<N>

source

pub fn enable_linear_motion_interpolation( &mut self, linear_motion_interpolation_enabled: bool ) -> &mut RigidBodyDesc<N>

source

pub fn status(self, status: BodyStatus) -> RigidBodyDesc<N>

source

pub fn set_status(&mut self, status: BodyStatus) -> &mut RigidBodyDesc<N>

source

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

source

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

source

pub fn velocity(self, velocity: Velocity2<N>) -> RigidBodyDesc<N>

source

pub fn set_velocity(&mut self, velocity: Velocity2<N>) -> &mut RigidBodyDesc<N>

source

pub fn linear_damping(self, linear_damping: N) -> RigidBodyDesc<N>

source

pub fn set_linear_damping(&mut self, linear_damping: N) -> &mut RigidBodyDesc<N>

source

pub fn angular_damping(self, angular_damping: N) -> RigidBodyDesc<N>

source

pub fn set_angular_damping( &mut self, angular_damping: N ) -> &mut RigidBodyDesc<N>

source

pub fn max_linear_velocity(self, max_linear_velocity: N) -> RigidBodyDesc<N>

source

pub fn set_max_linear_velocity( &mut self, max_linear_velocity: N ) -> &mut RigidBodyDesc<N>

source

pub fn max_angular_velocity(self, max_angular_velocity: N) -> RigidBodyDesc<N>

source

pub fn set_max_angular_velocity( &mut self, max_angular_velocity: N ) -> &mut RigidBodyDesc<N>

source

pub fn local_inertia(self, local_inertia: Inertia2<N>) -> RigidBodyDesc<N>

source

pub fn set_local_inertia( &mut self, local_inertia: Inertia2<N> ) -> &mut RigidBodyDesc<N>

source

pub fn local_center_of_mass( self, local_center_of_mass: OPoint<N, Const<2>> ) -> RigidBodyDesc<N>

source

pub fn set_local_center_of_mass( &mut self, local_center_of_mass: OPoint<N, Const<2>> ) -> &mut RigidBodyDesc<N>

source

pub fn sleep_threshold(self, sleep_threshold: Option<N>) -> RigidBodyDesc<N>

source

pub fn set_sleep_threshold( &mut self, sleep_threshold: Option<N> ) -> &mut RigidBodyDesc<N>

source

pub fn kinematic_translations( self, kinematic_translations: Matrix<bool, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<bool, 2, 1>> ) -> RigidBodyDesc<N>

source

pub fn set_translations_kinematic( &mut self, kinematic_translations: Matrix<bool, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<bool, 2, 1>> ) -> &mut RigidBodyDesc<N>

source

pub fn get_rotation(&self) -> N

source

pub fn get_kinematic_rotations(&self) -> bool

source

pub fn get_angular_inertia(&self) -> N

source

pub fn get_translation( &self ) -> &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>

source

pub fn get_mass(&self) -> N

source

pub fn is_gravity_enabled(&self) -> bool

source

pub fn is_linear_motion_interpolation_enabled(&self) -> bool

source

pub fn get_status(&self) -> BodyStatus

source

pub fn get_sleep_threshold(&self) -> Option<N>

source

pub fn get_linear_damping(&self) -> N

source

pub fn get_angular_damping(&self) -> N

source

pub fn get_max_linear_velocity(&self) -> N

source

pub fn get_max_angular_velocity(&self) -> N

source

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

source

pub fn get_velocity(&self) -> &Velocity2<N>

source

pub fn get_local_inertia(&self) -> &Inertia2<N>

source

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

source

pub fn build(&self) -> RigidBody<N>

Builds a rigid body from this description.

Trait Implementations§

source§

impl<N> Clone for RigidBodyDesc<N>where N: Clone + RealField + Copy,

source§

fn clone(&self) -> RigidBodyDesc<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<N> !RefUnwindSafe for RigidBodyDesc<N>

§

impl<N> Send for RigidBodyDesc<N>

§

impl<N> Sync for RigidBodyDesc<N>

§

impl<N> Unpin for RigidBodyDesc<N>where N: Unpin,

§

impl<N> !UnwindSafe for RigidBodyDesc<N>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, 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.
§

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

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

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

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

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

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

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

impl<T> Finalize for T

§

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

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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<T> UserData for Twhere T: Clone + Any + Send + Sync,

source§

fn clone_boxed(&self) -> Box<dyn UserData, Global>

Clone this trait-object.
source§

fn to_any(&self) -> Box<dyn Any + Send + Sync, Global>

Clone as its super-trait trait objects.
source§

fn as_any(&self) -> &(dyn Any + Send + Sync + 'static)

Downcast to Any.
§

impl<T> Component for Twhere T: Send + Sync + 'static,