BodyDef class
class BodyDef { /** * The body type: static, kinematic, or dynamic. * Note: if a dynamic body would have zero mass, the mass is set to one. */ int type; /** * The world angle of the body in radians. */ num angle; /** User can store whatever they wish in here. */ Object userData; /** The world position of the body. */ vec2 position; /** Linear velocity of the body in world coordinates. */ vec2 linearVelocity; /** Angular velocity of the body. */ num angularVelocity; /** * If true, the body will be allowed to rotate. Otherwise, its rotation will * be fixed. */ bool fixedRotation; /** If true, this body is initially sleeping. */ bool isSleeping; /** * 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 kinematic and static bodies. This setting is only * considered on dynamic bodies. * * You should use this flag sparingly since it increases processing time. */ bool bullet; /** Set to false to prevent a body from ever falling asleep. */ bool allowSleep; /** * Linear damping is used to reduce the linear velocity. The damping * parameter can be larger than 1.0 but the damping effect becomes * sensitive to the time step when the damping parameter is large. */ num linearDamping; /** * Angular damping is used to reduce the angular velocity. The * damping parameter can be larger than 1.0 but the damping effect * becomes sensitive to time step when the damping parameter is large. */ num angularDamping; /** Is this body initially awake or asleep? */ bool awake; /** If true, this body starts out active. */ bool active; /** * Constructs a new BodyDef with default values. */ BodyDef() : userData = null, bullet = false, type = BodyType.STATIC, position = new vec2.zero(), angle = 0, linearDamping = 0, angularDamping = 0, allowSleep = true, awake = true, fixedRotation = false, active = true, linearVelocity = new vec2.zero(), angularVelocity = 0; }
Constructors
new BodyDef() #
Constructs a new BodyDef with default values.
BodyDef() : userData = null, bullet = false, type = BodyType.STATIC, position = new vec2.zero(), angle = 0, linearDamping = 0, angularDamping = 0, allowSleep = true, awake = true, fixedRotation = false, active = true, linearVelocity = new vec2.zero(), angularVelocity = 0;
Properties
bool active #
active
bool allowSleep #
allowSleep
num angle #
angle
num angularDamping #
angularDamping
num angularVelocity #
angularVelocity
bool awake #
awake
bool bullet #
bullet
bool fixedRotation #
fixedRotation
bool isSleeping #
isSleeping
num linearDamping #
linearDamping
int type #
type
Object userData #
userData