Options
All
  • Public
  • Public/Protected
  • All
Menu

A body definition holds all the data needed to construct a rigid body. You can safely re-use body definitions.

Hierarchy

  • b2BodyDef

Index

Constructors

constructor

Properties

active

active: boolean

Does this body start out active?

allowSleep

allowSleep: boolean

Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.

angle

angle: number

The world angle of the body in radians.

angularDamping

angularDamping: number

Angular damping is use to reduce the angular velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large.

angularVelocity

angularVelocity: number

The angular velocity of the body.

awake

awake: boolean

Is this body initially awake or sleeping?

bullet

bullet: boolean

Is this a fast moving body that should be prevented from tunneling through other moving bodies? Note that all bodies are prevented from tunneling through static bodies.

warning

You should use this flag sparingly since it increases processing time.

fixedRotation

fixedRotation: boolean

Should this body be prevented from rotating? Useful for characters.

inertiaScale

inertiaScale: number

Scales the inertia tensor.

warning

Experimental

linearDamping

linearDamping: number

Linear damping is use to reduce the linear velocity. The damping parameter can be larger than 1.0f but the damping effect becomes sensitive to the time step when the damping parameter is large.

linearVelocity

linearVelocity: b2Vec2

The linear velocity of the body's origin in world co-ordinates.

position

position: b2Vec2

The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.

type

type: number

The body type: static, kinematic, or dynamic. A member of the b2BodyType class .

note

If a dynamic body would have zero mass, the mass is set to one.

userData

userData: any

Use this to store application specific body data.

Generated using TypeDoc