Skip to main content

Interface: ShapeBase

Defined in: physics/shapes/shape.ts:12

Common contract implemented by all collision shapes.

Properties

type

type: ShapeType

Defined in: physics/shapes/shape.ts:16

The kind of shape this is, used to dispatch collision detection.

Methods

getArea()

getArea(): number

Defined in: physics/shapes/shape.ts:22

Calculates the area of the shape.

Returns

number

The area of the shape.


getBoundingRadius()

getBoundingRadius(): number

Defined in: physics/shapes/shape.ts:37

Calculates the radius of the smallest circle, centered on the shape's local origin, that fully contains the shape. Used for broad-phase AABB calculations.

Returns

number

The bounding radius of the shape.


getMomentOfInertia()

getMomentOfInertia(mass): number

Defined in: physics/shapes/shape.ts:29

Calculates the moment of inertia of the shape for a given mass.

Parameters

mass

number

The mass of the body the shape belongs to.

Returns

number

The moment of inertia of the shape.