Class GridBroadphase

Axis aligned uniform grid broadphase.

Todo

Needs support for more than just planes and spheres.

Hierarchy (view full)

Constructors

  • Parameters

    • Optional aabbMin: Vec3
    • Optional aabbMax: Vec3
    • Optional nx: number

      Number of boxes along x.

    • Optional ny: number

      Number of boxes along y.

    • Optional nz: number

      Number of boxes along z.

    Returns GridBroadphase

Properties

aabbMax: Vec3

aabbMax

aabbMin: Vec3

aabbMin

binLengths: number[]

binLengths

bins: Body[][]

bins

dirty: boolean

Set to true if the objects in the world moved.

nx: number

Number of boxes along x

ny: number

Number of boxes along y

nz: number

Number of boxes along z

useBoundingBoxes: boolean

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

world: World

The world to search for collisions in.

Methods

  • Get all the collision pairs in the physics world

    Parameters

    Returns void

  • Check if the bounding spheres of two bodies are intersecting.

    Parameters

    • bodyA: Body
    • bodyB: Body
    • pairs1: Body[]

      bodyA is appended to this array if intersection

    • pairs2: Body[]

      bodyB is appended to this array if intersection

    Returns void

  • Check if the bounding volumes of two bodies intersect.

    Parameters

    Returns void

  • Removes duplicate pairs from the pair arrays.

    Parameters

    Returns void

  • To be implemented by subcasses

    Parameters

    Returns void

  • Check if the bounding spheres of two bodies overlap.

    Parameters

    Returns boolean