Struct rapier3d::dynamics::RigidBodyBuilder[][src]

#[must_use = "Builder functions return the updated builder"]
pub struct RigidBodyBuilder { pub position: Isometry<Real>, pub linvel: Vector<Real>, pub angvel: AngVector<Real>, pub gravity_scale: Real, pub linear_damping: Real, pub angular_damping: Real, pub mass_properties: MassProperties, pub can_sleep: bool, pub sleeping: bool, pub ccd_enabled: bool, pub dominance_group: i8, pub user_data: u128, // some fields omitted }
Expand description

A builder for rigid-bodies.

Fields

position: Isometry<Real>

The initial position of the rigid-body to be built.

linvel: Vector<Real>

The linear velocity of the rigid-body to be built.

angvel: AngVector<Real>

The angular velocity of the rigid-body to be built.

gravity_scale: Real

The scale factor applied to the gravity affecting the rigid-body to be built, 1.0 by default.

linear_damping: Real

Damping factor for gradually slowing down the translational motion of the rigid-body, 0.0 by default.

angular_damping: Real

Damping factor for gradually slowing down the angular motion of the rigid-body, 0.0 by default.

mass_properties: MassProperties

The additional mass properties of the rigid-body being built. See RigidBodyBuilder::additional_mass_properties for more information.

can_sleep: bool

Whether or not the rigid-body to be created can sleep if it reaches a dynamic equilibrium.

sleeping: bool

Whether or not the rigid-body is to be created asleep.

ccd_enabled: bool

Whether continuous collision-detection is enabled for the rigid-body to be built.

dominance_group: i8

The dominance group of the rigid-body to be built.

user_data: u128

An arbitrary user-defined 128-bit integer associated to the rigid-bodies built by this builder.

Implementations

impl RigidBodyBuilder[src]

pub fn new(rb_type: RigidBodyType) -> Self[src]

Initialize a new builder for a rigid body which is either static, dynamic, or kinematic.

pub fn new_static() -> Self[src]

Initializes the builder of a new static rigid body.

pub fn new_kinematic_velocity_based() -> Self[src]

Initializes the builder of a new kinematic rigid body.

pub fn new_kinematic_position_based() -> Self[src]

Initializes the builder of a new kinematic rigid body.

pub fn new_dynamic() -> Self[src]

Initializes the builder of a new dynamic rigid body.

pub fn gravity_scale(self, scale_factor: Real) -> Self[src]

Sets the scale applied to the gravity force affecting the rigid-body to be created.

pub fn dominance_group(self, group: i8) -> Self[src]

Sets the dominance group of this rigid-body.

pub fn translation(self, translation: Vector<Real>) -> Self[src]

Sets the initial translation of the rigid-body to be created.

pub fn rotation(self, angle: AngVector<Real>) -> Self[src]

Sets the initial orientation of the rigid-body to be created.

pub fn position(self, pos: Isometry<Real>) -> Self[src]

Sets the initial position (translation and orientation) of the rigid-body to be created.

pub fn user_data(self, data: u128) -> Self[src]

An arbitrary user-defined 128-bit integer associated to the rigid-bodies built by this builder.

pub fn additional_mass_properties(self, props: MassProperties) -> Self[src]

Sets the additional mass properties of the rigid-body being built.

Note that “additional” means that the final mass properties of the rigid-bodies depends on the initial mass-properties of the rigid-body (set by this method) to which is added the contributions of all the colliders with non-zero density attached to this rigid-body.

Therefore, if you want your provided mass properties to be the final mass properties of your rigid-body, don’t attach colliders to it, or only attach colliders with densities equal to zero.

pub fn lock_translations(self) -> Self[src]

Prevents this rigid-body from translating because of forces.

pub fn lock_rotations(self) -> Self[src]

Prevents this rigid-body from rotating because of forces.

pub fn restrict_rotations(
    self,
    allow_rotations_x: bool,
    allow_rotations_y: bool,
    allow_rotations_z: bool
) -> Self
[src]

Only allow rotations of this rigid-body around specific coordinate axes.

pub fn additional_mass(self, mass: Real) -> Self[src]

Sets the additional mass of the rigid-body being built.

This is only the “additional” mass because the total mass of the rigid-body is equal to the sum of this additional mass and the mass computed from the colliders (with non-zero densities) attached to this rigid-body.

pub fn mass(self, mass: Real) -> Self[src]

👎 Deprecated:

renamed to additional_mass.

Sets the additional mass of the rigid-body being built.

This is only the “additional” mass because the total mass of the rigid-body is equal to the sum of this additional mass and the mass computed from the colliders (with non-zero densities) attached to this rigid-body.

pub fn additional_principal_angular_inertia(
    self,
    inertia: AngVector<Real>
) -> Self
[src]

Sets the additional principal angular inertia of this rigid-body.

This is only the “additional” angular inertia because the total angular inertia of the rigid-body is equal to the sum of this additional value and the angular inertia computed from the colliders (with non-zero densities) attached to this rigid-body.

pub fn principal_angular_inertia(self, inertia: AngVector<Real>) -> Self[src]

👎 Deprecated:

renamed to additional_principal_angular_inertia.

Sets the principal angular inertia of this rigid-body.

pub fn principal_inertia(self, inertia: AngVector<Real>) -> Self[src]

👎 Deprecated:

renamed to additional_principal_angular_inertia.

Use self.principal_angular_inertia instead.

pub fn linear_damping(self, factor: Real) -> Self[src]

Sets the damping factor for the linear part of the rigid-body motion.

The higher the linear damping factor is, the more quickly the rigid-body will slow-down its translational movement.

pub fn angular_damping(self, factor: Real) -> Self[src]

Sets the damping factor for the angular part of the rigid-body motion.

The higher the angular damping factor is, the more quickly the rigid-body will slow-down its rotational movement.

pub fn linvel(self, linvel: Vector<Real>) -> Self[src]

Sets the initial linear velocity of the rigid-body to be created.

pub fn angvel(self, angvel: AngVector<Real>) -> Self[src]

Sets the initial angular velocity of the rigid-body to be created.

pub fn can_sleep(self, can_sleep: bool) -> Self[src]

Sets whether or not the rigid-body to be created can sleep if it reaches a dynamic equilibrium.

pub fn ccd_enabled(self, enabled: bool) -> Self[src]

Sets whether or not continuous collision-detection is enabled for this rigid-body.

pub fn sleeping(self, sleeping: bool) -> Self[src]

Sets whether or not the rigid-body is to be created asleep.

pub fn build(&self) -> RigidBody[src]

Build a new rigid-body with the parameters configured with this builder.

Trait Implementations

impl Clone for RigidBodyBuilder[src]

fn clone(&self) -> RigidBodyBuilder[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for RigidBodyBuilder[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl PartialEq<RigidBodyBuilder> for RigidBodyBuilder[src]

fn eq(&self, other: &RigidBodyBuilder) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &RigidBodyBuilder) -> bool[src]

This method tests for !=.

impl StructuralPartialEq for RigidBodyBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Downcast for T where
    T: Any
[src]

pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>[src]

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

pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>[src]

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

pub fn as_any(&self) -> &(dyn Any + 'static)[src]

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)[src]

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

impl<T> DowncastSync for T where
    T: Any + Send + Sync
[src]

pub fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + 'static + Sync + Send>[src]

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

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

pub fn to_subset(&self) -> Option<SS>[src]

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

pub fn is_in_subset(&self) -> bool[src]

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

pub fn to_subset_unchecked(&self) -> SS[src]

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

pub fn from_subset(element: &SS) -> SP[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.