pub struct RigidBody<N: RealField + Copy> { /* private fields */ }
Expand description
A rigid body.
Implementations§
Source§impl<N: RealField + Copy> RigidBody<N>
impl<N: RealField + Copy> RigidBody<N>
Sourcepub fn user_data(&self) -> Option<&(dyn Any + Send + Sync)>
pub fn user_data(&self) -> Option<&(dyn Any + Send + Sync)>
Retrieves a reference to the user-defined user-data attached to this object.
Sourcepub fn user_data_mut(&mut self) -> Option<&mut (dyn Any + Send + Sync)>
pub fn user_data_mut(&mut self) -> Option<&mut (dyn Any + Send + Sync)>
Retrieves a mutable reference to the user-defined user-data attached to this object.
Sourcepub fn set_user_data(
&mut self,
data: Option<Box<dyn Any + Send + Sync>>,
) -> Option<Box<dyn Any + Send + Sync>>
pub fn set_user_data( &mut self, data: Option<Box<dyn Any + Send + Sync>>, ) -> Option<Box<dyn Any + Send + Sync>>
Sets the user-defined data attached to this object.
Sourcepub fn take_user_data(&mut self) -> Option<Box<dyn Any + Send + Sync>>
pub fn take_user_data(&mut self) -> Option<Box<dyn Any + Send + Sync>>
Replace by None
the user-defined data attached to this object and returns the old value.
Sourcepub fn linear_motion_interpolation_enabled(&self) -> bool
pub fn linear_motion_interpolation_enabled(&self) -> bool
Check if linear motion interpolation is enabled for CCD.
If this is disabled, non-linear interpolation will be used.
Sourcepub fn enable_linear_motion_interpolation(&mut self, enabled: bool)
pub fn enable_linear_motion_interpolation(&mut self, enabled: bool)
Enable linear motion interpolation for CCD.
If this is disabled, non-linear interpolation will be used.
Sourcepub fn set_translations_kinematic(&mut self, is_kinematic: Vector<bool>)
pub fn set_translations_kinematic(&mut self, is_kinematic: Vector<bool>)
Mark some translational degrees of freedom as kinematic.
Sourcepub fn set_rotations_kinematic(&mut self, is_kinematic: bool)
pub fn set_rotations_kinematic(&mut self, is_kinematic: bool)
Mark rotations as kinematic.
Sourcepub fn kinematic_translations(&self) -> Vector<bool>
pub fn kinematic_translations(&self) -> Vector<bool>
Flags indicating which translational degrees of freedoms are kinematic.
Sourcepub fn kinematic_rotations(&self) -> bool
pub fn kinematic_rotations(&self) -> bool
Flags indicating if rotations are kinematic.
Sourcepub fn disable_all_rotations(&mut self)
pub fn disable_all_rotations(&mut self)
Disable all rotations of this rigid body.
This is the same as setting all the rotations of this rigid body as kinematic and setting its angular velocity to zero. The rotations will still be controllable at the velocity level by the user afterwards.
Sourcepub fn enable_all_rotations(&mut self)
pub fn enable_all_rotations(&mut self)
Enable all rotations for this rigid body.
This is the same as setting all the rotations of this rigid body as non-kinematic.
Sourcepub fn disable_all_translations(&mut self)
pub fn disable_all_translations(&mut self)
Disable all translations of this rigid body.
This is the same as setting all the translations of this rigid body as kinematic and setting its linear velocity to zero. The translations will still be controllable at the velocity level by the user afterwards.
Sourcepub fn enable_all_translations(&mut self)
pub fn enable_all_translations(&mut self)
Enable all translations for this rigid body.
This is the same as setting all the translations of this rigid body as non-kinematic.
Sourcepub fn set_linear_damping(&mut self, damping: N)
pub fn set_linear_damping(&mut self, damping: N)
Sets the linear damping coefficient of this rigid body.
Linear damping will make the rigid body loose linear velocity automatically velocity at each timestep. There is no damping by default.
Sourcepub fn linear_damping(&self) -> N
pub fn linear_damping(&self) -> N
The linear damping coefficient of this rigid body.
Sourcepub fn set_angular_damping(&mut self, damping: N)
pub fn set_angular_damping(&mut self, damping: N)
Sets the angular damping coefficient of this rigid body.
Angular damping will make the rigid body loose angular velocity automatically velocity at each timestep. There is no damping by default.
Sourcepub fn angular_damping(&self) -> N
pub fn angular_damping(&self) -> N
The angular damping coefficient of this rigid body.
Sourcepub fn set_max_linear_velocity(&mut self, max_vel: N)
pub fn set_max_linear_velocity(&mut self, max_vel: N)
Caps the linear velocity of this rigid body to the given maximum.
This will prevent a rigid body from having a linear velocity with magnitude greater than max_vel
.
Sourcepub fn max_linear_velocity(&self) -> N
pub fn max_linear_velocity(&self) -> N
The maximum allowed linear velocity of this rigid body.
Sourcepub fn set_max_angular_velocity(&mut self, max_vel: N)
pub fn set_max_angular_velocity(&mut self, max_vel: N)
Caps the angular velocity of this rigid body to the given maximum.
This will prevent a rigid body from having a angular velocity with magnitude greater than max_vel
.
Sourcepub fn max_angular_velocity(&self) -> N
pub fn max_angular_velocity(&self) -> N
The maximum allowed angular velocity of this rigid body.
Sourcepub fn activation_status_mut(&mut self) -> &mut ActivationStatus<N>
pub fn activation_status_mut(&mut self) -> &mut ActivationStatus<N>
Mutable information regarding activation and deactivation (sleeping) of this rigid body.
Sourcepub fn set_local_center_of_mass(&mut self, local_com: Point<N>)
pub fn set_local_center_of_mass(&mut self, local_com: Point<N>)
Set the center of mass of this rigid body, expressed in its local space.
Sourcepub fn set_local_inertia(&mut self, local_inertia: Inertia<N>)
pub fn set_local_inertia(&mut self, local_inertia: Inertia<N>)
Set the local inertia of this rigid body, expressed in its local space.
Sourcepub fn set_angular_inertia(&mut self, angular_inertia: N)
pub fn set_angular_inertia(&mut self, angular_inertia: N)
Set the angular inertia of this rigid body, expressed in its local space.
Sourcepub fn set_position(&mut self, pos: Isometry<N>)
pub fn set_position(&mut self, pos: Isometry<N>)
Sets the position of this rigid body.
Sourcepub fn set_velocity(&mut self, vel: Velocity<N>)
pub fn set_velocity(&mut self, vel: Velocity<N>)
Set the velocity of this rigid body.
Sourcepub fn set_linear_velocity(&mut self, vel: Vector<N>)
pub fn set_linear_velocity(&mut self, vel: Vector<N>)
Set the linear velocity of this rigid body.
Sourcepub fn set_angular_velocity(&mut self, vel: N)
pub fn set_angular_velocity(&mut self, vel: N)
Set the angular velocity of this rigid body.
Sourcepub fn augmented_mass(&self) -> &Inertia<N>
pub fn augmented_mass(&self) -> &Inertia<N>
The augmented mass (inluding gyroscropic terms) in world-space of this rigid body.
Sourcepub fn inv_augmented_mass(&self) -> &Inertia<N>
pub fn inv_augmented_mass(&self) -> &Inertia<N>
The inverse augmented mass (inluding gyroscropic terms) in world-space of this rigid body.
Trait Implementations§
Source§impl<N: RealField + Copy> Body<N> for RigidBody<N>
impl<N: RealField + Copy> Body<N> for RigidBody<N>
Source§fn activation_status(&self) -> &ActivationStatus<N>
fn activation_status(&self) -> &ActivationStatus<N>
Source§fn activate_with_energy(&mut self, energy: N)
fn activate_with_energy(&mut self, energy: N)
Source§fn deactivate(&mut self)
fn deactivate(&mut self)
Source§fn set_deactivation_threshold(&mut self, threshold: Option<N>)
fn set_deactivation_threshold(&mut self, threshold: Option<N>)
Source§fn update_status(&self) -> BodyUpdateStatus
fn update_status(&self) -> BodyUpdateStatus
Source§fn status(&self) -> BodyStatus
fn status(&self) -> BodyStatus
Source§fn set_status(&mut self, status: BodyStatus)
fn set_status(&mut self, status: BodyStatus)
Source§fn deformed_positions(&self) -> Option<(DeformationsType, &[N])>
fn deformed_positions(&self) -> Option<(DeformationsType, &[N])>
Source§fn deformed_positions_mut(&mut self) -> Option<(DeformationsType, &mut [N])>
fn deformed_positions_mut(&mut self) -> Option<(DeformationsType, &mut [N])>
Source§fn companion_id(&self) -> usize
fn companion_id(&self) -> usize
Source§fn set_companion_id(&mut self, id: usize)
fn set_companion_id(&mut self, id: usize)
Source§fn generalized_velocity(&self) -> DVectorSlice<'_, N>
fn generalized_velocity(&self) -> DVectorSlice<'_, N>
Source§fn generalized_velocity_mut(&mut self) -> DVectorSliceMut<'_, N>
fn generalized_velocity_mut(&mut self) -> DVectorSliceMut<'_, N>
Source§fn generalized_acceleration(&self) -> DVectorSlice<'_, N>
fn generalized_acceleration(&self) -> DVectorSlice<'_, N>
Source§fn integrate(&mut self, parameters: &IntegrationParameters<N>)
fn integrate(&mut self, parameters: &IntegrationParameters<N>)
Source§fn clear_forces(&mut self)
fn clear_forces(&mut self)
Source§fn clear_update_flags(&mut self)
fn clear_update_flags(&mut self)
Source§fn update_kinematics(&mut self)
fn update_kinematics(&mut self)
fn step_started(&mut self)
fn advance(&mut self, time_ratio: N)
fn validate_advancement(&mut self)
fn clamp_advancement(&mut self)
fn part_motion(&self, _: usize, time_origin: N) -> Option<BodyPartMotion<N>>
Source§fn update_dynamics(&mut self, dt: N)
fn update_dynamics(&mut self, dt: N)
Source§fn update_acceleration(
&mut self,
gravity: &Vector<N>,
_: &IntegrationParameters<N>,
)
fn update_acceleration( &mut self, gravity: &Vector<N>, _: &IntegrationParameters<N>, )
Source§fn apply_displacement(&mut self, displacement: &[N])
fn apply_displacement(&mut self, displacement: &[N])
Source§fn world_point_at_material_point(
&self,
_: &dyn BodyPart<N>,
point: &Point<N>,
) -> Point<N>
fn world_point_at_material_point( &self, _: &dyn BodyPart<N>, point: &Point<N>, ) -> Point<N>
Source§fn position_at_material_point(
&self,
_: &dyn BodyPart<N>,
point: &Point<N>,
) -> Isometry<N>
fn position_at_material_point( &self, _: &dyn BodyPart<N>, point: &Point<N>, ) -> Isometry<N>
Source§fn material_point_at_world_point(
&self,
_: &dyn BodyPart<N>,
point: &Point<N>,
) -> Point<N>
fn material_point_at_world_point( &self, _: &dyn BodyPart<N>, point: &Point<N>, ) -> Point<N>
Source§fn gravity_enabled(&self) -> bool
fn gravity_enabled(&self) -> bool
Source§fn enable_gravity(&mut self, enabled: bool)
fn enable_gravity(&mut self, enabled: bool)
Source§fn velocity_at_point(&self, _: usize, point: &Point<N>) -> Velocity<N>
fn velocity_at_point(&self, _: usize, point: &Point<N>) -> Velocity<N>
Source§fn fill_constraint_geometry(
&self,
_: &dyn BodyPart<N>,
_: usize,
point: &Point<N>,
force_dir: &ForceDirection<N>,
j_id: usize,
wj_id: usize,
jacobians: &mut [N],
inv_r: &mut N,
ext_vels: Option<&DVectorSlice<'_, N>>,
out_vel: Option<&mut N>,
)
fn fill_constraint_geometry( &self, _: &dyn BodyPart<N>, _: usize, point: &Point<N>, force_dir: &ForceDirection<N>, j_id: usize, wj_id: usize, jacobians: &mut [N], inv_r: &mut N, ext_vels: Option<&DVectorSlice<'_, N>>, out_vel: Option<&mut N>, )
center
(relative to the body part’s center of mass) and
the direction dir
. Read moreSource§fn has_active_internal_constraints(&mut self) -> bool
fn has_active_internal_constraints(&mut self) -> bool
true
if this bodies contains internal constraints that need to be solved.Source§fn setup_internal_velocity_constraints(
&mut self,
_: &DVectorSlice<'_, N>,
_: &IntegrationParameters<N>,
)
fn setup_internal_velocity_constraints( &mut self, _: &DVectorSlice<'_, N>, _: &IntegrationParameters<N>, )
Source§fn warmstart_internal_velocity_constraints(
&mut self,
_: &mut DVectorSliceMut<'_, N>,
)
fn warmstart_internal_velocity_constraints( &mut self, _: &mut DVectorSliceMut<'_, N>, )
Source§fn step_solve_internal_velocity_constraints(
&mut self,
_: &mut DVectorSliceMut<'_, N>,
)
fn step_solve_internal_velocity_constraints( &mut self, _: &mut DVectorSliceMut<'_, N>, )
Source§fn step_solve_internal_position_constraints(
&mut self,
_: &IntegrationParameters<N>,
)
fn step_solve_internal_position_constraints( &mut self, _: &IntegrationParameters<N>, )
Source§fn add_local_inertia_and_com(
&mut self,
_: usize,
com: Point<N>,
inertia: Inertia<N>,
)
fn add_local_inertia_and_com( &mut self, _: usize, com: Point<N>, inertia: Inertia<N>, )
Source§fn apply_force(
&mut self,
_: usize,
force: &Force<N>,
force_type: ForceType,
auto_wake_up: bool,
)
fn apply_force( &mut self, _: usize, force: &Force<N>, force_type: ForceType, auto_wake_up: bool, )
Source§fn apply_local_force(
&mut self,
_: usize,
force: &Force<N>,
force_type: ForceType,
auto_wake_up: bool,
)
fn apply_local_force( &mut self, _: usize, force: &Force<N>, force_type: ForceType, auto_wake_up: bool, )
Source§fn apply_force_at_point(
&mut self,
_: usize,
force: &Vector<N>,
point: &Point<N>,
force_type: ForceType,
auto_wake_up: bool,
)
fn apply_force_at_point( &mut self, _: usize, force: &Vector<N>, point: &Point<N>, force_type: ForceType, auto_wake_up: bool, )
Source§fn apply_local_force_at_point(
&mut self,
_: usize,
force: &Vector<N>,
point: &Point<N>,
force_type: ForceType,
auto_wake_up: bool,
)
fn apply_local_force_at_point( &mut self, _: usize, force: &Vector<N>, point: &Point<N>, force_type: ForceType, auto_wake_up: bool, )
Source§fn apply_force_at_local_point(
&mut self,
_: usize,
force: &Vector<N>,
point: &Point<N>,
force_type: ForceType,
auto_wake_up: bool,
)
fn apply_force_at_local_point( &mut self, _: usize, force: &Vector<N>, point: &Point<N>, force_type: ForceType, auto_wake_up: bool, )
Source§fn apply_local_force_at_local_point(
&mut self,
_: usize,
force: &Vector<N>,
point: &Point<N>,
force_type: ForceType,
auto_wake_up: bool,
)
fn apply_local_force_at_local_point( &mut self, _: usize, force: &Vector<N>, point: &Point<N>, force_type: ForceType, auto_wake_up: bool, )
Source§fn update_activation_status(&mut self)
fn update_activation_status(&mut self)
Source§fn status_dependent_ndofs(&self) -> usize
fn status_dependent_ndofs(&self) -> usize
Source§fn status_dependent_body_part_velocity(
&self,
part: &dyn BodyPart<N>,
) -> Velocity<N>
fn status_dependent_body_part_velocity( &self, part: &dyn BodyPart<N>, ) -> Velocity<N>
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Source§fn is_kinematic(&self) -> bool
fn is_kinematic(&self) -> bool
Source§impl<N: RealField + Copy> BodyPart<N> for RigidBody<N>
impl<N: RealField + Copy> BodyPart<N> for RigidBody<N>
Source§fn safe_position(&self) -> Isometry<N>
fn safe_position(&self) -> Isometry<N>
Source§fn local_inertia(&self) -> Inertia<N>
fn local_inertia(&self) -> Inertia<N>
Source§fn center_of_mass(&self) -> Point<N>
fn center_of_mass(&self) -> Point<N>
Source§fn local_center_of_mass(&self) -> Point<N>
fn local_center_of_mass(&self) -> Point<N>
Auto Trait Implementations§
impl<N> Freeze for RigidBody<N>where
N: Freeze,
impl<N> !RefUnwindSafe for RigidBody<N>
impl<N> Send for RigidBody<N>
impl<N> Sync for RigidBody<N>
impl<N> Unpin for RigidBody<N>where
N: Unpin,
impl<N> !UnwindSafe for RigidBody<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.