World2D

World2D

Class responsible for updating bodies,constraints and composites.

Constructor

new World2D()

Source:

Classes

World2D

Members

CLMDs

Description:
  • The collision manifolds that have passed narrowphase and verified to be colliding.
Source:
The collision manifolds that have passed narrowphase and verified to be colliding.

CLMDs

Source:

broadphase :Broadphase

Description:
  • This is a cheap way of determining which pairs of bodies could be colliding.
Source:
This is a cheap way of determining which pairs of bodies could be colliding.
Type:

contactList :Array.<CollisionPair>

Description:
  • The collision manifolds that have passed broadphase and could be colliding
Source:
Deprecated:
  • Yes
The collision manifolds that have passed broadphase and could be colliding
Type:

fixedFrameRate :number

Description:
  • Time in seconds that a single frame takes.This has more precedence than the first parameter of World2D.update(),set to this to zero if you want to use the latter as the delta time.
Source:
Time in seconds that a single frame takes.This has more precedence than the first parameter of World2D.update(),set to this to zero if you want to use the latter as the delta time.
Type:
  • number

gravitationalAcceleration :Vector2

Description:
  • The gravitational pull of the world.
Source:
The gravitational pull of the world.
Type:

gravity :Vector2

Description:
  • Gravitational pull of the world,will affect all bodies except static bodies.
Source:
Deprecated:
  • Yes
Gravitational pull of the world,will affect all bodies except static bodies.
Type:

narrowphase :NarrowPhase

Description:
  • This accurately tests body pairs to check for collision and outputs a manifold for each body pair.
Source:
This accurately tests body pairs to check for collision and outputs a manifold for each body pair.
Type:

Methods

query(bound, outopt) → {Array.<T>}

Description:
  • Searches for objects in a given bounds and returns them.
Source:
Parameters:
Name Type Attributes Default Description
bound Bounds the region to search in
out Array.<T> <optional>
[] an array to store results in
Returns:
Type
Array.<T>

(static) applyGravity(gravity, movable, bodies)

Source:
Parameters:
Name Type Description
gravity Vector2
movable Array.<Array.<Movable>>
bodies Array.<Array.<Body2D>>

(static) broadPhase(world)

Source:
Parameters:
Name Type Description
world World2D

(static) collisionDetection(manager, world)

Source:
Parameters:
Name Type Description
manager any
world World2D

(static) collisionResponse(dt, manager, world, CLMDs)

Source:
Parameters:
Name Type Description
dt number
manager Manager
world World2D
CLMDs string | Array.<any>

(static) narrowPhase(manager, world, contactList)

Source:
Parameters:
Name Type Description
manager any
world World2D
contactList Array.<CollisionPair>

(static) update(world, bodies, dt, manager, entities, transform, movable, bounds)

Source:
Parameters:
Name Type Description
world World2D
bodies Array.<Array.<Body2D>>
dt Number the time passed between the last call and this call.
manager Manager
entities Array.<Array.<Entity>>
transform Array.<Array.<Transform>>
movable Array.<Array.<Movable>>
bounds Array.<Array.<BoundingBox>>

(static) updateBodies(bodies, transform, bounds)

Source:
Parameters:
Name Type Description
bodies Array.<Array.<Body2D>>
transform Array.<Array.<Transform>>
bounds Array.<Array.<BoundingBox>>