Class CAAT.Module.Collision.SpatialHash
Defined in: SpatialHash.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
Columns to partition the space.
|
|
A collection ob objects to test collision among them.
|
|
Space height
|
|
Spare rectangle to hold temporary calculations.
|
|
Spare rectangle to hold temporary calculations.
|
|
Rows to partition the space.
|
|
Space width
|
Method Attributes | Method Name and Description |
---|---|
<private> |
__getCells(x, y, width, height)
|
<private> |
_solveCollisionCell(cell, callback)
|
addObject(obj)
Add an element of the form { id, x,y,width,height, rectangular }
|
|
collide(x, y, w, h, oncollide)
|
|
initialize(w, h, rows, columns)
|
|
solveCollision(callback)
|
Field Detail
columns
Columns to partition the space.
elements
A collection ob objects to test collision among them.
height
Space height
r0
Spare rectangle to hold temporary calculations.
r1
Spare rectangle to hold temporary calculations.
rows
Rows to partition the space.
width
Space width
Method Detail
<private>
__getCells(x, y, width, height)
- Parameters:
- x
- y
- width
- height
<private>
_solveCollisionCell(cell, callback)
- Parameters:
- cell
- callback
addObject(obj)
Add an element of the form { id, x,y,width,height, rectangular }
- Parameters:
- obj
clearObject()
collide(x, y, w, h, oncollide)
- Parameters:
- x
- y
- w
- h
- oncollide
- function that returns boolean. if returns true, stop testing collision.
initialize(w, h, rows, columns)
- Parameters:
- w
- h
- rows
- columns
solveCollision(callback)
- Parameters:
- callback