Struct nphysics3d::object::RigidBody
[−]
[src]
pub struct RigidBody { // some fields omitted }
The rigid body structure.
This is the structure describing an object on the physics world.
Methods
impl RigidBody
[src]
fn position(&self) -> &Matrix
Gets a reference to this body's transform.
fn shape_ref(&self) -> &Repr<Point, Matrix>
Gets a reference to this body's shape.
fn shape(&self) -> Arc<Box<Repr<Point, Matrix>>>
Gets a copy of this body's shared shape.
fn margin(&self) -> Scalar
The margin surrounding this object's shape.
fn center_of_mass(&self) -> &Point
Gets a reference to this body's center of mass.
fn restitution(&self) -> Scalar
Gets this body's restitution coefficent.
The actual restitution coefficient of a contact is computed averaging the two bodies restitution coefficient.
fn friction(&self) -> Scalar
Gets this body's friction coefficient.
The actual friction coefficient of a contact is computed averaging the two bodies friction coefficient.
fn is_active(&self) -> bool
Indicates whether or not this rigid body is active.
An inactive rigid body is a body that did not move for some time. It is not longer simulated by the physics engine as long as no other object touches it. It is automatically activated by the physics engine.
fn deactivation_threshold(&self) -> Option<Scalar>
The velocity threshold bellow whith the rigid body might be deactivated.
If None, the object cannot be deactivated. If the total squared velocity (i-e: v2 + w2) falls bellow this threshold for a long enough time, the rigid body will fall asleep (i-e be "frozen") for performance reasons.
fn set_deactivation_threshold(&mut self, threshold: Option<Scalar>)
Set the velocity threshold bellow whith the rigid body might be deactivated.
If None, the object cannot be deactivated. If the total squared velocity (i-e: v2 + w2) falls bellow this threshold for a long enough time, the rigid body will fall asleep (i-e be "frozen") for performance reasons.
fn new_dynamic<G>(shape: G, density: Scalar, restitution: Scalar, friction: Scalar) -> RigidBody where G: Send + Sync + Repr<Point, Matrix> + Volumetric<Scalar, Point, AngularInertia>
Creates a new rigid body that can move.
fn new_static<G>(shape: G, restitution: Scalar, friction: Scalar) -> RigidBody where G: Send + Sync + Repr<Point, Matrix>
Creates a new rigid body that cannot move.
fn new(shape: Arc<Box<Repr<Point, Matrix>>>, mass_properties: Option<(Scalar, Point, AngularInertia)>, restitution: Scalar, friction: Scalar) -> RigidBody
Creates a new rigid body with a given shape.
Use this if the shape is shared by multiple rigid bodies.
Set mass_properties
to None
if the rigid body is to be static.
fn can_move(&self) -> bool
Indicates whether this rigid body is static or dynamic.
fn lin_acc_scale(&self) -> Vect
Gets the linear acceleraction scale of this rigid body.
fn set_lin_acc_scale(&mut self, scale: Vect)
Sets the linear acceleration scale of this rigid body.
fn ang_acc_scale(&self) -> Orientation
Gets the angular acceleration scale of this rigid body.
fn set_ang_acc_scale(&mut self, scale: Orientation)
Sets the angular acceleration scale of this rigid body.
fn lin_vel(&self) -> Vect
Get the linear velocity of this rigid body.
fn set_lin_vel(&mut self, lv: Vect)
Sets the linear velocity of this rigid body.
fn lin_acc(&self) -> Vect
Gets the linear acceleration of this rigid body.
fn set_lin_acc(&mut self, lf: Vect)
Sets the linear acceleration of this rigid body.
Note that this might be reset by the physics engine automatically.
fn ang_vel(&self) -> Orientation
Gets the angular velocity of this rigid body.
fn set_ang_vel(&mut self, av: Orientation)
Sets the angular velocity of this rigid body.
fn ang_acc(&self) -> Orientation
Gets the angular acceleration of this rigid body.
fn set_ang_acc(&mut self, af: Orientation)
Sets the angular acceleration of this rigid body.
Note that this might be reset by the physics engine automatically.
fn clear_forces(&mut self)
Resets linear and angular force.
fn clear_linear_force(&mut self)
Resets linear force.
fn clear_angular_force(&mut self)
Resets angular force.
fn append_lin_force(&mut self, force: Vect)
Adds an additional linear force.
fn append_ang_force(&mut self, force: Orientation)
Adds an additional angular force.
fn append_force_wrt_point(&mut self, force: Vect, pnt_to_com: Vect)
Adds an additional force acting at a point different to the center of mass.
The pnt_to_com
vector has to point from the center of mass to
the point where the force acts.
fn apply_central_impulse(&mut self, impulse: Vect)
Applies a one-time central impulse.
fn apply_angular_momentum(&mut self, ang_moment: Orientation)
Applies a one-time angular impulse.
fn apply_impulse_wrt_point(&mut self, impulse: Vect, pnt_to_com: Vect)
Applies a one-time impulse to a point relative to the center of mass.
The pnt_to_com
vector has to point from the center of mass to the
point where the impulse acts.
fn inv_mass(&self) -> Scalar
Gets the inverse mass of this rigid body.
fn set_inv_mass(&mut self, m: Scalar)
Sets the inverse mass of this rigid body.
fn inv_inertia(&self) -> &AngularInertia
Gets the inverse inertia tensor of this rigid body.
fn set_inv_inertia(&mut self, ii: AngularInertia)
Sets the inverse inertia tensor of this rigid body.
Not that this is reset at every update by the physics engine.
fn append_transformation(&mut self, to_append: &Matrix)
Appends a transformation to this rigid body.
fn prepend_transformation(&mut self, to_prepend: &Matrix)
Prepends a transformation to this rigid body.
fn set_transformation(&mut self, m: Matrix)
Sets the transformation of this rigid body.
fn append_translation(&mut self, t: &Vect)
Appends a translation to this rigid body.
fn prepend_translation(&mut self, t: &Vect)
Prepends a translation to this rigid body.
fn set_translation(&mut self, t: Vect)
Stes the translation of this rigid body.
fn append_rotation(&mut self, rot: &Orientation)
Appends a rotation to this rigid body.
fn prepend_rotation(&mut self, rot: &Orientation)
Prepends a rotation to this rigid body.
fn set_rotation(&mut self, r: Orientation)
Sets the rotation of this rigid body.
fn user_data(&self) -> &Option<Box<Any>>
Reference to user-defined data attached to this rigid body.
fn user_data_mut(&mut self) -> &mut Option<Box<Any>>
Mutable reference to user-defined data attached to this rigid body.
Trait Implementations
impl Clone for RigidBody
[src]
fn clone(&self) -> RigidBody
Clones this rigid body but not its associated user-data.
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<M> HasBoundingVolume<M, BoundingSphere<Point>> for RigidBody where M: Copy + Mul<Matrix, Output=Matrix>
[src]
fn bounding_volume(&self, m: &M) -> BoundingSphere<Point>
The bounding volume of self
transformed by m
.
impl<M> HasBoundingVolume<M, AABB<Point>> for RigidBody where M: Copy + Mul<Matrix, Output=Matrix>
[src]
fn bounding_volume(&self, m: &M) -> AABB<Point>
The bounding volume of self
transformed by m
.