Skip to main content

Interface: RigidBodyOptions

Defined in: physics/rigid-body.ts:7

Options for creating a RigidBody.

Properties

angle?

optional angle: number

Defined in: physics/rigid-body.ts:21

The world-space rotation of the body, in radians.


density?

optional density: number

Defined in: physics/rigid-body.ts:41

The density of the body, used to calculate mass and inertia from the shape's area. Ignored for static bodies.


friction?

optional friction: number

Defined in: physics/rigid-body.ts:51

The friction coefficient of the body, clamped to the range [0, 1].


isSensor?

optional isSensor: boolean

Defined in: physics/rigid-body.ts:35

Whether the body is a sensor. Sensor bodies still participate in collision detection (and so still produce collisionStarts / collisionEnds events), but are skipped during collision resolution - they apply no impulses or positional correction to either body in the pair.


isStatic?

optional isStatic: boolean

Defined in: physics/rigid-body.ts:26

Whether the body is static (immovable, infinite mass).


position?

optional position: Vector2

Defined in: physics/rigid-body.ts:16

The world-space position of the body's center of mass.


restitution?

optional restitution: number

Defined in: physics/rigid-body.ts:46

The restitution (bounciness) of the body, clamped to the range [0, 1].


shape

shape: Shape

Defined in: physics/rigid-body.ts:11

The collision shape of the body.