BodyDef class

Holds all the data needed to construct a Body.

You can safely re-use body definitions.

Shapes are added through Fixtures to a Body after construction via Body.createFixture.


BodyDef({BodyType type = BodyType.static, Object? userData, Vector2? position, double angle = 0.0, Vector2? linearVelocity, double angularVelocity = 0.0, double linearDamping = 0.0, double angularDamping = 0.0, bool allowSleep = true, bool isAwake = true, bool fixedRotation = false, bool bullet = false, bool active = true, Vector2? gravityOverride, Vector2? gravityScale})


active bool
Does this body start out active?
getter/setter pair
allowSleep bool
Set this flag to false if this body should never fall asleep.
getter/setter pair
angle double
The world angle of the body in radians.
getter/setter pair
angularDamping double
Angular damping is use to reduce the angular velocity.
getter/setter pair
angularVelocity double
The angular velocity of the body.
getter/setter pair
bullet bool
Is this a fast moving body that should be prevented from tunneling through other moving bodies?
getter/setter pair
fixedRotation bool
Should this body be prevented from rotating?
getter/setter pair
gravityOverride Vector2?
Changes how the World treats the gravity for this body.
getter/setter pair
gravityScale Vector2?
Multiplier for the body's gravity.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isAwake bool
Is this body initially sleeping?
getter/setter pair
linearDamping double
Linear damping is use to reduce the linear velocity.
getter/setter pair
linearVelocity Vector2
The linear velocity of the body in world co-ordinates.
getter/setter pair
position Vector2
The world position of the body.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type BodyType
The body type: static, kinematic, or dynamic.
getter/setter pair
userData Object?
Use this to store application specific body data.
getter/setter pair


noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.