Body class

Inheritance
Implementers

Constructors

Body({required double mass, required double moment})

Properties

hashCode int
The hash code for this object.
no setterinherited
isExist bool
no setter
isSleeping bool
Returns true if the body is sleeping.
no setter
kineticEnergy double
Get the amount of kinetic energy contained by the body.
no setter
p ↔ Vector2
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sleeping Sleeping
no setter
transform → Matrix4
no setter
v ↔ Vector2
getter/setter pair

Methods

activate() → void
Wake up a sleeping or idle body.
activateStatic(Shape filter) → void
Wake up any sleeping or idle bodies touching a static body.
applyForceAtLocalPoint({required Vector2 force, required Vector2 point}) → void
Apply a force to a body. Both the force and point are expressed in body local coordinates.
applyForceAtWorldPoint({required Vector2 force, required Vector2 point}) → void
Apply a force to a body. Both the force and point are expressed in world coordinates.
applyImpulseAtLocalPoint({required Vector2 impulse, required Vector2 point}) → void
Apply an impulse to a body. Both the impulse and point are expressed in world coordinates.
applyImpulseAtWorldPoint({required Vector2 impulse, required Vector2 point}) → void
Apply an impulse to a body. Both the impulse and point are expressed in world coordinates.
destroy() → void
Destroy a Body.
eachArbiter(void arbiterFunc(Body body, Arbiter arbiter)) → void
Call @c func once for each arbiter that is currently active on the body.
eachConstraint(void constraintFunc(Body body, Constraint constraint)) → void
Call @c func once for each constraint attached to @c body and added to the space.
eachShape(void shapeFunc(Body body, Shape shape)) → void
Call @c func once for each shape attached to @c body and added to the space.
getAngle() double
Get the angle of the body.
getAngularVelocity() double
Get the angular velocity of the body.
getCenterOfGravity() → Vector2
Get the offset of the center of gravity in body local coordinates.
getData<T>() → T?
Get the user data assigned to the body.
getForce() → Vector2
Get the force applied to the body for the next time step.
getMass() double
Get the mass of the body.
getMoment() double
Get the moment of inertia of the body.
getPosition() → Vector2
Set the position of a body.
getRotation() → Vector2
Get the rotation vector of the body. (The x basis vector of it's transform.)
getSpace() Space
Get the space this body is added to.
getTorque() double
Get the torque applied to the body for the next time step.
getType() BodyType
Get the type of the body.
getVelocity() → Vector2
Get the velocity of the body.
getVelocityAtLocalPoint(Vector2 point) → Vector2
Get the velocity on a body (in world units) at a point on the body in local coordinates.
getVelocityAtWorldPoint({required Vector2 point}) → Vector2
Get the velocity on a body (in world units) at a point on the body in world coordinates.
localToWorld(Vector2 point) → Vector2
Convert body relative/local coordinates to absolute/world coordinates.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeData() → void
Remove the user data assigned to the body.
setAngle(double a) → void
Set the angle of a body.
setAngularVelocity(double angularVelocity) → void
Set the angular velocity of the body.
setCenterOfGravity(Vector2 cog) → void
Set the offset of the center of gravity in body local coordinates.
setData<T>(T data) → void
Set the user data assigned to the body.
setForce(Vector2 force) → void
Set the force applied to the body for the next time step.
setMass(double m) → void
Set the mass of the body.
setMoment(double i) → void
Set the moment of inertia of the body.
setPosition({required Vector2 pos}) → void
Set the position of the body.
setPositionUpdateFunc(void positionFunc(Body body, double dt)) → void
Set the callback used to update a body's position. NOTE: It's not generally recommended to override this unless you call the default position update function.
setTorque(double torque) → void
Set the torque applied to the body for the next time step.
setType(BodyType type) → void
Set the type of the body.
setVelocity({required Vector2 vel}) → void
Set the velocity of the body.
setVelocityUpdateFunc(void velocityFunc(Body body, Vector2 gravity, double damping, double dt)) → void
Set the callback used to update a body's velocity.
sleep() → void
Force a body to fall asleep immediately.
sleepWithGroup(Body body) → void
Force a body to fall asleep immediately along with other bodies in a group.
toString() String
A string representation of this object.
inherited
updatePosition(double dt) → void
Default position integration function.
updateVelocity({required Vector2 gravity, required double damping, required double dt}) → void
Default velocity integration function..
worldToLocal(Vector2 point) → Vector2
Convert body absolute/world coordinates to relative/local coordinates.

Operators

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