Interface RigidBodyOptions

RigidBody configuration options

 const rigidBody = new RigidBody({
rigidBodyType: RigidBodyType.Dynamic,
gravity: 10,
velocity: new Vector2(1, 0),
acceleration: new Vector2(1, 0)
});
 const rigidBody = new RigidBody({
rigidBodyType: RigidBodyType.Kinematic,
velocity: new Vector2(1, 0),
acceleration: new Vector2(1, 0)
});
 const rigidBody = new RigidBody({
rigidBodyType: RigidBodyType.Static,
});
interface RigidBodyOptions {
    acceleration: Vector2;
    gravity: number;
    type: RigidBodyType;
    velocity: Vector2;
}

Properties

acceleration: Vector2

Acceleration expressed in pixels per second squared. For Dynamic and Kinematic bodies.

gravity: number

Gravity expressed in pixels per second squared. Only for Dynamic bodies.

The type of the rigid body to create:

  • Dynamic: This type of body is affected by gravity and velocity and can be moved by other rigid bodies.
  • Kinematic: This type of body is not affected by gravity and cannot be moved by other rigid bodies, but can be velocity applied.
  • Static: This type of body is immobile, is not affected by velocity or gravity and cannot be moved by other rigid bodies.
velocity: Vector2

Velocity applied to the x-axis and y-axis expressed in pixels per second. For Dynamic and Kinematic bodies.