Skip to main content

SparseHashGridCollisionProcessor

This collision processor uses a sparsely populated grid of uniform cells to bucket potential colliders together for the purpose of detecting collision pairs and collisions.

Implements

Index

Constructors

constructor

Properties

public_pairPool

_pairPool: Pool<Pair> = ...

readonlygridSize

gridSize: number

readonlyhashGrid

Methods

broadphase

  • Runs the broadphase sweep over tracked colliders and returns possible collision pairs


    Parameters

    Returns Pair[]

debug

  • Draws the internal data structure


    Parameters

    Returns void

getColliders

  • Get all tracked colliders


    Returns readonly Collider[]

narrowphase

  • Runs a fine grain pass on collision pairs and does geometry intersection tests producing any contacts


    Parameters

    Returns CollisionContact[]

query

  • Query the collision processor for colliders that contain the point


    Parameters

    Returns Collider[]

rayCast

track

  • Adds the collider to the internal data structure for collision tracking


    Parameters

    Returns void

untrack

  • Removes a collider from the internal data structure for tracking collisions


    Parameters

    Returns void

update

  • update(targets: Collider[], delta: number): number
  • Perform data structure maintenance, returns number of colliders updated


    Parameters

    Returns number