Class: HSHG

.HSHG. HSHG

HSHG

new gdjs.HSHG.HSHG()

A hierarchical spatial grid containing objects and allowing fast test collisions between them.

Methods

addObject()

Add an object to the grid. The object can be anything as long as it provides a getAABB method. An 'HSHG' property is added to the object, and is then deleted when the object is removed from the HSHG.

queryForCollisionWith(theObject)

Return a list of objects colliding with theObject.

Name Type Description
theObject gdjs.RuntimeObject

The object to be tested against.

removeObject()

Remove an object from the HSHG. The object must be in the HSHG before being removed.

Must be called when objects have been moved ( typically at each "tick" of the game/simulation ).