1 decade ago by Joncom
In game.js on line 261, there is a comment:
The second sentence is true but incomplete and potentially misleading.
It excludes the case of an entity being smaller than one cell, but overlapping multiple.
I suggest the following:
// Insert all entities into a spatial hash and check them against any // other entity that already resides in the same cell. Entities that are // bigger than a single cell, are inserted into each one they intersect // with.
The second sentence is true but incomplete and potentially misleading.
It excludes the case of an entity being smaller than one cell, but overlapping multiple.
I suggest the following:
// Insert all entities into a spatial hash and check them against any // other entity that already resides in the same cell. Entities not contained // within a single cell are inserted into each one they intersect with.