Struct mgf::RigidBody
[−]
[src]
pub struct RigidBody { pub restitution: f32, pub friction: f32, pub total_inv_mass: f32, pub inv_moment_body: Matrix3<f32>, pub inv_moment: Matrix3<f32>, pub v: Vector3<f32>, pub omega: Vector3<f32>, pub v_step: Vector3<f32>, pub linear_m: Vector3<f32>, pub angular_m: Vector3<f32>, pub force: Vector3<f32>, pub torque: Vector3<f32>, pub collider: Compound, pub component_masses: Vec<f32>, }
A eneric physical body that has a mass, a volume, and experiences linear and rotational movement.
A RigidBody is technically a shape, although its geomtries are all considered to be in motion.
Fields
restitution: f32
friction: f32
total_inv_mass: f32
inv_moment_body: Matrix3<f32>
inv_moment: Matrix3<f32>
v: Vector3<f32>
omega: Vector3<f32>
v_step: Vector3<f32>
linear_m: Vector3<f32>
angular_m: Vector3<f32>
force: Vector3<f32>
torque: Vector3<f32>
collider: Compound
component_masses: Vec<f32>
Methods
impl RigidBody
[src]
fn new(
restitution: f32,
friction: f32,
world_force: Vector3<f32>,
shapes: Vec<Component>,
masses: Vec<f32>
) -> Self
[src]
restitution: f32,
friction: f32,
world_force: Vector3<f32>,
shapes: Vec<Component>,
masses: Vec<f32>
) -> Self
Construct a new RigidBody from a Vec of Components and masses.
Trait Implementations
impl Clone for RigidBody
[src]
fn clone(&self) -> RigidBody
[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 AddAssign<Vector3<f32>> for RigidBody
[src]
fn add_assign(&mut self, v: Vector3<f32>)
[src]
Performs the +=
operation.
impl SubAssign<Vector3<f32>> for RigidBody
[src]
fn sub_assign(&mut self, v: Vector3<f32>)
[src]
Performs the -=
operation.
impl Shape for RigidBody
[src]
fn center(&self) -> Point3<f32>
[src]
The center returned by a RigidBody is the center of mass for that object.
fn set_pos(&mut self, p: Point3<f32>)
[src]
Sets the center of the shape to p.
impl Delta for RigidBody
[src]
impl BoundedBy<AABB> for RigidBody
[src]
impl BoundedBy<Sphere> for RigidBody
[src]
impl<RHS> Contacts<RHS> for RigidBody where
RHS: Contacts<Moving<Component>> + BoundedBy<AABB>,
[src]
RHS: Contacts<Moving<Component>> + BoundedBy<AABB>,
fn contacts<F: FnMut(Contact)>(&self, rhs: &RHS, callback: F) -> bool
[src]
Calls the closure for each contact found. Returns true if any contact was found. Read more
fn last_contact(&self, rhs: &RHS) -> Option<Contact>
[src]
Returns the last contact found, if one exists.
impl PhysicsObject for RigidBody
[src]
fn integrate(&mut self, dt: f32)
[src]
Integrate the object over the timestep
fn state(&self) -> PhysicsState
[src]
Return the physics state of the object
fn apply_impulse(&mut self, linear: Vector3<f32>, angular: Vector3<f32>)
[src]
Apply linear and angular impulse to the object
fn update_dx(&mut self)
[src]
Update the linear and angular positional derivatives