Struct nphysics2d::object::RigidBody
[−]
[src]
pub struct RigidBody<N: Real> { /* fields omitted */ }
The rigid body structure.
This is the structure describing an object on the physics world.
Methods
impl<N: Real> RigidBody<N>
[src]
fn position(&self) -> &Isometry<N>
[src]
Gets a reference to this body's transform.
fn position_center(&self) -> Point<N>
[src]
The center given by this object's position. May not be the same as its center of mass.
This is the point with coordinates self.position().translation.vector
.
fn shape(&self) -> &ShapeHandle<Point<N>, Isometry<N>>
[src]
A reference to this body's shape handle.
fn margin(&self) -> N
[src]
The margin surrounding this object's shape.
fn set_margin(&mut self, margin: N)
[src]
Sets the margin surrounding this object's shape.
fn center_of_mass(&self) -> &Point<N>
[src]
Gets a reference to this body's center of mass.
fn mass(&self) -> Option<N>
[src]
Gets this body's mass, if it has one.
fn restitution(&self) -> N
[src]
Gets this body's restitution coefficent.
The actual restitution coefficient of a contact is computed averaging the two bodies restitution coefficient.
fn friction(&self) -> N
[src]
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
[src]
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<N>
[src]
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<N>)
[src]
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: N,
restitution: N,
friction: N
) -> RigidBody<N> where
G: Send + Sync + Shape<Point<N>, Isometry<N>> + Volumetric<N, Point<N>, AngularInertia<N>>,
[src]
shape: G,
density: N,
restitution: N,
friction: N
) -> RigidBody<N> where
G: Send + Sync + Shape<Point<N>, Isometry<N>> + Volumetric<N, Point<N>, AngularInertia<N>>,
Creates a new rigid body that can move.
fn new_static<G>(shape: G, restitution: N, friction: N) -> RigidBody<N> where
G: Send + Sync + Shape<Point<N>, Isometry<N>>,
[src]
G: Send + Sync + Shape<Point<N>, Isometry<N>>,
Creates a new rigid body that cannot move.
fn new(
shape: ShapeHandle<Point<N>, Isometry<N>>,
mass_properties: Option<(N, Point<N>, AngularInertia<N>)>,
restitution: N,
friction: N
) -> RigidBody<N>
[src]
shape: ShapeHandle<Point<N>, Isometry<N>>,
mass_properties: Option<(N, Point<N>, AngularInertia<N>)>,
restitution: N,
friction: N
) -> RigidBody<N>
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
[src]
Indicates whether this rigid body is static or dynamic.
fn lin_acc_scale(&self) -> Vector<N>
[src]
Gets the linear acceleraction scale of this rigid body.
fn set_lin_acc_scale(&mut self, scale: Vector<N>)
[src]
Sets the linear acceleration scale of this rigid body.
fn ang_acc_scale(&self) -> Orientation<N>
[src]
Gets the angular acceleration scale of this rigid body.
fn set_ang_acc_scale(&mut self, scale: Orientation<N>)
[src]
Sets the angular acceleration scale of this rigid body.
fn lin_vel(&self) -> Vector<N>
[src]
Get the linear velocity of this rigid body.
fn set_lin_vel(&mut self, lv: Vector<N>)
[src]
Sets the linear velocity of this rigid body.
fn lin_acc(&self) -> Vector<N>
[src]
Gets the linear acceleration of this rigid body.
fn ang_vel(&self) -> Orientation<N>
[src]
Gets the angular velocity of this rigid body.
fn set_ang_vel(&mut self, av: Orientation<N>)
[src]
Sets the angular velocity of this rigid body.
fn ang_acc(&self) -> Orientation<N>
[src]
Gets the angular acceleration of this rigid body.
fn clear_forces(&mut self)
[src]
Resets linear and angular force.
fn clear_linear_force(&mut self)
[src]
Resets linear force.
fn clear_angular_force(&mut self)
[src]
Resets angular force.
fn append_lin_force(&mut self, force: Vector<N>)
[src]
Adds an additional linear force.
fn append_ang_force(&mut self, force: Orientation<N>)
[src]
Adds an additional angular force.
fn append_force_wrt_point(&mut self, force: Vector<N>, pnt_to_com: Vector<N>)
[src]
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 wake_up(&mut self)
[src]
Forces the body to respond to any impulses before the next tick.
fn apply_central_impulse(&mut self, impulse: Vector<N>)
[src]
Applies a one-time central impulse.
fn apply_angular_momentum(&mut self, ang_moment: Orientation<N>)
[src]
Applies a one-time angular impulse.
fn apply_impulse_wrt_point(&mut self, impulse: Vector<N>, pnt_to_com: Vector<N>)
[src]
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) -> N
[src]
Gets the inverse mass of this rigid body.
fn set_inv_mass(&mut self, m: N)
[src]
Sets the inverse mass of this rigid body.
fn inv_inertia(&self) -> &AngularInertia<N>
[src]
Gets the inverse inertia tensor of this rigid body.
fn set_inv_inertia(&mut self, ii: AngularInertia<N>)
[src]
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: &Isometry<N>)
[src]
Appends a transformation to this rigid body.
fn prepend_transformation(&mut self, to_prepend: &Isometry<N>)
[src]
Prepends a transformation to this rigid body.
fn set_transformation(&mut self, m: Isometry<N>)
[src]
Sets the transformation of this rigid body.
fn append_translation(&mut self, t: &Translation<N>)
[src]
Appends a translation to this rigid body.
fn prepend_translation(&mut self, t: &Translation<N>)
[src]
Prepends a translation to this rigid body.
fn set_translation(&mut self, t: Translation<N>)
[src]
Stes the translation of this rigid body.
fn append_rotation(&mut self, rot: &Rotation<N>)
[src]
Appends a rotation to this rigid body.
fn prepend_rotation(&mut self, rot: &Rotation<N>)
[src]
Prepends a rotation to this rigid body.
fn set_rotation(&mut self, rot: Rotation<N>)
[src]
Sets the rotation of this rigid body.
fn collision_groups(&self) -> &RigidBodyCollisionGroups
[src]
Reference to the collision groups of this rigid body.
fn set_collision_groups(&mut self, new_groups: RigidBodyCollisionGroups)
[src]
Set the new collisions groups of this rigid body.
fn user_data(&self) -> Option<&Box<Any>>
[src]
Reference to user-defined data attached to this rigid body.
fn user_data_mut(&mut self) -> Option<&mut Box<Any>>
[src]
Mutable reference to user-defined data attached to this rigid body.
fn set_user_data(&mut self, user_data: Option<Box<Any>>) -> Option<Box<Any>>
[src]
Attach some user-defined data to this rigid body and return the old one.
Trait Implementations
impl<N: Real> Clone for RigidBody<N>
[src]
fn clone(&self) -> RigidBody<N>
[src]
Clones this rigid body but not its associated user-data.
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<N, M> HasBoundingVolume<M, BoundingSphere<Point<N>>> for RigidBody<N> where
N: Real,
M: Copy + Mul<Isometry<N>, Output = Isometry<N>>,
[src]
N: Real,
M: Copy + Mul<Isometry<N>, Output = Isometry<N>>,
fn bounding_volume(&self, m: &M) -> BoundingSphere<Point<N>>
[src]
The bounding volume of self
transformed by m
.
impl<N, M> HasBoundingVolume<M, AABB<Point<N>>> for RigidBody<N> where
N: Real,
M: Copy + Mul<Isometry<N>, Output = Isometry<N>>,
[src]
N: Real,
M: Copy + Mul<Isometry<N>, Output = Isometry<N>>,
fn bounding_volume(&self, m: &M) -> AABB<Point<N>>
[src]
The bounding volume of self
transformed by m
.