Struct mgf::PhysicsState
[−]
[src]
pub struct PhysicsState {
pub restitution: f32,
pub friction: f32,
pub inv_mass: f32,
pub inv_moment: Matrix3<f32>,
pub x: Point3<f32>,
pub v: Vector3<f32>,
pub omega: Vector3<f32>,
}A description of the physical state of an object.
Fields
restitution: f32
Restitution is a measure of how much kinetic energy is retained in a collision. 100% of kinetic energy retention corresponds to a coefficient of one.
friction: f32
We simply friction in this case to simply be a ratio of the normal force applied tangentially to an object during collision.
inv_mass: f32
We only ever need inverse mass for calcuations, plus it gives a neat advantage that we can represent immovable objects with an infinite mass, or an inverse mass of zero.
inv_moment: Matrix3<f32>
After our inital tensor calculation it is up to the containing class to maintain the correct tensor should hitboxes beyond their inital state.
x: Point3<f32>
Position of the object at the beginning of the timestep.
v: Vector3<f32>
Linear velocity of object
omega: Vector3<f32>
Angular velocity of object
Methods
impl PhysicsState[src]
fn resolve_contact<Config, ObjA, ObjB>(
obj_a: &mut ObjA,
obj_b: &mut ObjB,
contact: &LocalContact,
dt: f32
) where
Config: PhysicsConfig,
ObjA: PhysicsObject,
ObjB: PhysicsObject, [src]
obj_a: &mut ObjA,
obj_b: &mut ObjB,
contact: &LocalContact,
dt: f32
) where
Config: PhysicsConfig,
ObjA: PhysicsObject,
ObjB: PhysicsObject,
Perform collision resolution on two physics states from a contact and a timestep.
fn resolve_manifold<Config, ObjA, ObjB>(
obj_a: &mut ObjA,
obj_b: &mut ObjB,
manifold: &Manifold,
dt: f32
) where
Config: PhysicsConfig,
ObjA: PhysicsObject,
ObjB: PhysicsObject, [src]
obj_a: &mut ObjA,
obj_b: &mut ObjB,
manifold: &Manifold,
dt: f32
) where
Config: PhysicsConfig,
ObjA: PhysicsObject,
ObjB: PhysicsObject,
Perform collision resolution from a manifold. This is the preferred method for resolving two bodies.
Trait Implementations
impl Copy for PhysicsState[src]
impl Clone for PhysicsState[src]
fn clone(&self) -> PhysicsState[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