Interface DynamicRigidBody

A rigid body in the physical world

interface DynamicRigidBody {
    acceleration: Vector2;
    angle: number;
    angularAcceleration: number;
    angularVelocity: number;
    averageAngle: number;
    averageCenter: Vector2;
    center: Vector2;
    centerOfPhysics: Vector2;
    data: any;
    fixedPosition: boolean;
    fixedRotation: boolean;
    floating: boolean;
    friction: number;
    id: number;
    inertia: number;
    mass: number;
    permeability: number;
    restingTime: number;
    restitution: number;
    shapes: Shape[];
    static: false;
    type: "BODY";
    velocity: Vector2;
}

Hierarchy

  • BodyCore
    • DynamicRigidBody

Properties

acceleration: Vector2

The current acceleration of the body

angle: number

The current angle of rotation of the body

angularAcceleration: number

The current angular acceleration of the body

angularVelocity: number

The current angular velocity of the body

averageAngle: number

The average angle of rotation of the bod - this keeps things stable

averageCenter: Vector2

The center of the body on average - this keeps things stable

center: Vector2

The center of the body

centerOfPhysics: Vector2

The center of rotation based on the last collision

data: any

User data associated with the body

fixedPosition: boolean

True if this body can not move

fixedRotation: boolean

True if this body can not rotate

floating: boolean

True if the body isn't effected by gravity

friction: number

The friction to apply for this body in a collision

id: number

The unique ID of this body

inertia: number

The current inertia of the body

mass: number

The mass of the body - must be non-zero for dynamic bodies

permeability: number

Permeability of the object - anything other than zero will stop collision response

restingTime: number

The amount of time this body has been resting for

restitution: number

The restitution to apply for this body in a collision

shapes: Shape[]
static: false
type: "BODY"

Discriminator

velocity: Vector2

The current velocity of the body