Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Shape<UserData>

The shapes describe geometry of the body, you can add many shapes to the body.

Type parameters

  • UserData = any

Hierarchy

Index

Constructors

constructor

Properties

aabb

aabb: AABB = ...

The axis-aligned bounding box of the shape.

area

area: number = 0

The area of the shape.

body

body: undefined | Body<any>

A body to which the shape is attached.

density

density: number = ...

The density of the shape.

filter

filter: Filter = ...

A collision filter of the shape

friction

friction: number

The friction of shape. Must be in range 0...Infinity.

id

id: number = ...

An id of the body

inertia

inertia: number = 0

The moment of inertia of the shape.

isSensor

isSensor: boolean

A flag that indicates whether a body is a sensor. Sensors does not react with other bodies but triggers collision events.

mass

mass: number = 0

The mass of the shape.

position

position: Vector = ...

Current position of the shape.

radius

radius: number

A rounding radius of the shape(radius of circle, radius of capsule, ...).

restitution

restitution: number

The restitution(elasticity) of the shape. Must be in range 0...1. A value of 0 means that the body will not bounce at all. A value of 1 means that the body may bounce with 100% of its kinetic energy.

surfaceVelocity

surfaceVelocity: number

The surface velocity of the shape. Useful for creating conveyor belts.

Abstract type

type: number = 0

A type of the shape.

Optional userData

userData: UserData

A variable that contains user data

Methods

Abstract contains

  • contains(point: Vector): boolean

Abstract getNormal

Abstract getPoint

  • getPoint(index: number): Vector

Abstract raycast

Abstract raycastRadius

Abstract rotate

  • rotate(angle: number): void

setDensity

  • setDensity(density: number): void

setMass

  • setMass(mass: number): void

Abstract support

Abstract translate

  • translate(vector: Vector): void

Abstract updateAABB

  • updateAABB(): AABB

Abstract updateArea

  • updateArea(): number

Abstract updateInertia

  • updateInertia(): number

Generated using TypeDoc