Skip to content

Commit a20a9fb

Browse files
committed
Fix the out-of-bounds check in grid broadphase
`world.bounds` is a normal bounds object with min and max coordinates instead of height and width.
1 parent a5b535d commit a20a9fb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/collision/Grid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ var Common = require('../core/Common');
6262
continue;
6363

6464
// don't update out of world bodies
65-
if (body.bounds.max.x < 0 || body.bounds.min.x > world.bounds.width
66-
|| body.bounds.max.y < 0 || body.bounds.min.y > world.bounds.height)
65+
if (body.bounds.max.x < world.bounds.min.x || body.bounds.min.x > world.bounds.max.x
66+
|| body.bounds.max.y < world.bounds.min.y || body.bounds.min.y > world.bounds.max.y)
6767
continue;
6868

6969
var newRegion = _getRegion(grid, body);

0 commit comments

Comments
 (0)