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>,
}

My entire understanding of the natural world as applied to video games encapsulated in one structure.

Fields

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.

We simply friction in this case to simply be a ratio of the normal force applied tangentially to an object during collision.

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.

After our inital tensor calculation it is up to the containing class to maintain the correct tensor should hitboxes beyond their inital state.

Position of the object at the beginning of the timestep.

Linear velocity of object

Angular velocity of object

Methods

impl PhysicsState
[src]

[src]

Perform collision resolution on two physics states from a contact and a timestep.

[src]

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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more