World class
The world class manages all physics entities, dynamic simulation, and asynchronous queries. The world also contains efficient memory management facilities.
Constructors
- World([Vector2? gravity, BroadPhase? broadPhase])
Properties
- autoClearForces → bool
-
Get the flag that controls automatic clearing of forces after each time
step.
no setter
-
bodies
→ List<
Body> -
final
- broadphaseTimer → Timer
-
final
- cA → Vector2
-
final
- cB → Vector2
-
final
- collision → Collision
-
final
- color → Color3i
-
final
- contactManager ↔ ContactManager
-
getter/setter pair
- debugDraw ↔ DebugDraw?
-
getter/setter pair
- destroyListener ↔ DestroyListener?
-
getter/setter pair
- distance → Distance
-
final
- flags ↔ int
-
getter/setter pair
- gravity ↔ Vector2
-
The current World's gravity.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- island → Island
-
final
- isLocked → bool
-
Is the world locked (in the middle of a time step).
no setter
-
joints
→ List<
Joint> -
final
- particleDestroyListener ↔ ParticleDestroyListener?
-
getter/setter pair
- particleSystem ↔ ParticleSystem
-
getter/setter pair
- proxyCount → int
-
Get the number of broad-phase proxies.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stack
→ List<
Body> -
final
- toi → TimeOfImpact
-
final
- xf → Transform
-
final
Methods
-
clearForces(
) → void - Call this after you are done with time steps to clear the forces. You normally call this after each call to stepDt, unless you are performing sub-steps. By default, forces will be automatically cleared, so you don't need to call this function.
-
createBody(
BodyDef def) → Body - Create a rigid body given a definition. No reference to the definition is retained.
-
createJoint(
Joint joint) → void - Adds a joint to constrain bodies together.
-
destroyBody(
Body body) → void - Destroys a rigid body given a definition. No reference to the definition is retained. This function is locked during callbacks.
-
destroyJoint(
Joint joint) → void - Destroys a joint. This may cause the connected bodies to begin colliding.
-
drawDebugData(
) → void - Call this to draw shapes and other debug draw data.
-
getTreeBalance(
) → int - Gets the balance of the dynamic tree
-
getTreeHeight(
) → int - Gets the height of the dynamic tree
-
getTreeQuality(
) → double - Gets the quality of the dynamic tree
-
isAllowSleep(
) → bool -
isSubStepping(
) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
queryAABB(
QueryCallback callback, AABB aabb) → void - Query the world for all fixtures that potentially overlap the provided AABB.
-
queryAABBParticle(
ParticleQueryCallback particleCallback, AABB aabb) → void - Query the world for all particles that potentially overlap the provided AABB.
-
queryAABBTwoCallbacks(
QueryCallback callback, ParticleQueryCallback particleCallback, AABB aabb) → void - Query the world for all fixtures and particles that potentially overlap the provided AABB.
-
raycast(
RayCastCallback callback, Vector2 point1, Vector2 point2) → void - Ray-cast the world for all fixtures in the path of the ray. Your callback controls whether you get the closest point, any point, or n-points. The ray-cast ignores shapes that contain the starting point.
-
raycastParticle(
ParticleRaycastCallback particleCallback, Vector2 point1, Vector2 point2) → void - Ray-cast the world for all particles in the path of the ray. Your callback controls whether you get the closest point, any point, or n-points.
-
raycastTwoCallBacks(
RayCastCallback callback, ParticleRaycastCallback particleCallback, Vector2 point1, Vector2 point2) → void - Ray-cast the world for all fixtures and particles in the path of the ray. Your callback controls whether you get the closest point, any point, or n-points. The ray-cast ignores shapes that contain the starting point.
-
setAllowSleep(
bool flag) → void -
setAutoClearForces(
bool shouldAutoClear) → void - Set flag to control automatic clearing of forces after each time step.
-
setContactFilter(
ContactFilter filter) → void - Register a contact filter to provide specific control over collision. Otherwise the default filter is used (_defaultFilter). The listener is owned by you and must remain in scope.
-
setContactListener(
ContactListener listener) → void - Register a contact event listener. The listener is owned by you and must remain in scope.
-
setSubStepping(
bool subStepping) → void -
solve(
TimeStep step) → void -
solveTOI(
TimeStep step) → void -
stepDt(
double dt) → void - Take a time step. This performs collision detection, integration, and constraint solution.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- clearForcesBit → const int
- locked → const int
- newFixture → const int