[−][src]Struct rapier2d::dynamics::RigidBodyBuilder
A builder for rigid-bodies.
Implementations
impl RigidBodyBuilder
[src]
pub fn new(body_status: BodyStatus) -> 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() -> 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 translation(self, x: f32, y: f32) -> Self
[src]
Sets the initial translation of the rigid-body to be created.
pub fn rotation(self, angle: AngVector<f32>) -> Self
[src]
Sets the initial orientation of the rigid-body to be created.
pub fn position(self, pos: Isometry<f32>) -> 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 mass_properties(self, props: MassProperties) -> Self
[src]
Sets the mass properties of the rigid-body being built.
Note 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.
This is equivalent to self.mass(0.0, false)
. See the
documentation of RigidBodyBuilder::mass
for more details.
pub fn lock_rotations(self) -> Self
[src]
Prevents this rigid-body from rotating because of forces.
This is equivalent to self.principal_inertia(0.0, false)
(in 2D) or
self.principal_inertia(Vector3::zeros(), Vector3::repeat(false))
(in 3D).
See the documentation of RigidBodyBuilder::principal_inertia
for more details.
pub fn mass(self, mass: f32, colliders_contribution_enabled: bool) -> Self
[src]
Sets the mass of the rigid-body being built.
In order to lock the translations of this rigid-body (by
making them kinematic), call .mass(0.0, false)
.
If colliders_contribution_enabled
is false
, then the mass specified here
will be the final mass of the rigid-body created by this builder.
If colliders_contribution_enabled
is true
, then the final mass of the rigid-body
will depends on the initial mass set by this method to which is added
the contributions of all the colliders with non-zero density attached to
this rigid-body.
pub fn principal_angular_inertia(
self,
inertia: f32,
colliders_contribution_enabled: bool
) -> Self
[src]
self,
inertia: f32,
colliders_contribution_enabled: bool
) -> Self
Sets the angular inertia of this rigid-body.
In order to lock the rotations of this rigid-body (by
making them kinematic), call .principal_inertia(0.0, false)
.
If colliders_contribution_enabled
is false
, then the principal inertia specified here
will be the final principal inertia of the rigid-body created by this builder.
If colliders_contribution_enabled
is true
, then the final principal of the rigid-body
will depend on the initial principal inertia set by this method to which is added
the contributions of all the colliders with non-zero density attached to this rigid-body.
pub fn principal_inertia(
self,
inertia: f32,
colliders_contribution_enabled: bool
) -> Self
[src]
self,
inertia: f32,
colliders_contribution_enabled: bool
) -> Self
renamed to principal_angular_inertia
.
Use self.principal_angular_inertia
instead.
pub fn linear_damping(self, factor: f32) -> 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: f32) -> 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, x: f32, y: f32) -> Self
[src]
Sets the initial linear velocity of the rigid-body to be created.
pub fn angvel(self, angvel: AngVector<f32>) -> 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 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.
Auto Trait Implementations
impl RefUnwindSafe for RigidBodyBuilder
impl Send for RigidBodyBuilder
impl Sync for RigidBodyBuilder
impl Unpin for RigidBodyBuilder
impl UnwindSafe for RigidBodyBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
[src]
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
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]
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,