API Docs for: 0.6.1
Show:

GridBroadphase Class

Axis aligned uniform grid broadphase.

Constructor

GridBroadphase

(
  • aabbMin
  • aabbMax
  • nx
  • ny
  • nz
)

Parameters:

  • aabbMin Vec3
  • aabbMax Vec3
  • nx Number

    Number of boxes along x

  • ny Number

    Number of boxes along y

  • nz Number

    Number of boxes along z

Methods

aabbQuery

(
  • world
  • aabb
  • result
)
Array

Returns all the bodies within the AABB.

Parameters:

  • world World
  • aabb AABB
  • result Array

    An array to store resulting bodies in.

Returns:

Array:

boundingSphereCheck

(
  • bodyA
  • bodyB
)
Boolean

Check if the bounding spheres of two bodies overlap.

Parameters:

Returns:

Boolean:

collisionPairs

(
  • world
  • pairs1
  • pairs2
)

Inherited from Broadphase but overwritten in src/collision/GridBroadphase.js:42

Get all the collision pairs in the physics world

Parameters:

  • world World
  • pairs1 Array
  • pairs2 Array

doBoundingBoxBroadphase

(
  • bodyA
  • bodyB
  • pairs1
  • pairs2
)

Check if the bounding boxes of two bodies are intersecting.

Parameters:

  • bodyA Body
  • bodyB Body
  • pairs1 Array
  • pairs2 Array

doBoundingSphereBroadphase

(
  • bodyA
  • bodyB
  • pairs1
  • pairs2
)

Check if the bounding spheres of two bodies are intersecting.

Parameters:

  • bodyA Body
  • bodyB Body
  • pairs1 Array

    bodyA is appended to this array if intersection

  • pairs2 Array

    bodyB is appended to this array if intersection

intersectionTest

(
  • bodyA
  • bodyB
  • pairs1
  • pairs2
)

Check if the bounding volumes of two bodies intersect.

Parameters:

  • bodyA Body
  • bodyB Body
  • pairs1 Array
  • pairs2 Array

makePairsUnique

(
  • pairs1
  • pairs2
)

Removes duplicate pairs from the pair arrays.

Parameters:

  • pairs1 Array
  • pairs2 Array

needBroadphaseCollision

(
  • bodyA
  • bodyB
)
Bool

Check if a body pair needs to be intersection tested at all.

Parameters:

Returns:

Bool:

setWorld

(
  • world
)

To be implemented by subcasses

Parameters:

Properties

dirty

Boolean

Set to true if the objects in the world moved.

useBoundingBoxes

Boolean

If set to true, the broadphase uses bounding boxes for intersection test, else it uses bounding spheres.

world

World

The world to search for collisions in.