BodyDef class

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

Constructors

BodyDef()

Properties

active bool
Does this body start out active?
read / write
allowSleep bool
Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.
read / write
angle double
The world angle of the body in radians.
read / write
angularDamping double
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.
read / write
angularVelocity double
The angular velocity of the body.
read / write
awake bool
Is this body initially sleeping?
read / write
bullet bool
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. [...]
read / write
fixedRotation bool
Should this body be prevented from rotating? Useful for characters.
read / write
gravityScale double
Experimental: scales the inertia tensor.
read / write
linearDamping double
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.
read / write
linearVelocity Vector2
The linear velocity of the body in world co-ordinates.
read / write
position Vector2
The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.
read / write
type BodyType
The body type: static, kinematic, or dynamic. Note: if a dynamic body would have zero mass, the mass is set to one.
read / write
userData Object
Use this to store application specific body data.
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

getAngle() double
The world angle of the body in radians.
getAngularDamping() double
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.
getAngularVelocity() double
The angular velocity of the body.
getGravityScale() double
Experimental: scales the inertia tensor.
getLinearDamping() double
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.
getLinearVelocity() Vector2
The linear velocity of the body in world co-ordinates.
getPosition() Vector2
The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.
getType() BodyType
The body type: static, kinematic, or dynamic. Note: if a dynamic body would have zero mass, the mass is set to one.
getUserData() Object
Use this to store application specific body data.
isActive() bool
Does this body start out active?
isAllowSleep() bool
Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.
isAwake() bool
Is this body initially sleeping?
isBullet() bool
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. [...]
isFixedRotation() bool
Should this body be prevented from rotating? Useful for characters.
setActive(bool active) → void
Does this body start out active?
setAllowSleep(bool allowSleep) → void
Set this flag to false if this body should never fall asleep. Note that this increases CPU usage.
setAngle(double angle) → void
The world angle of the body in radians.
setAngularDamping(double angularDamping) → void
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.
setAngularVelocity(double angularVelocity) → void
The angular velocity of the body.
setAwake(bool awake) → void
Is this body initially sleeping?
setBullet(bool bullet) → void
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. [...]
setFixedRotation(bool fixedRotation) → void
Should this body be prevented from rotating? Useful for characters.
setGravityScale(double gravityScale) → void
Experimental: scales the inertia tensor.
setLinearDamping(double linearDamping) → void
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.
setLinearVelocity(Vector2 linearVelocity) → void
The linear velocity of the body in world co-ordinates.
setPosition(Vector2 position) → void
The world position of the body. Avoid creating bodies at the origin since this can lead to many overlapping shapes.
setType(BodyType type) → void
The body type: static, kinematic, or dynamic. Note: if a dynamic body would have zero mass, the mass is set to one.
setUserData(Object userData) → void
Use this to store application specific body data.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited