Skip to content

Commit

Permalink
Fix the out-of-bounds check in grid broadphase
Browse files Browse the repository at this point in the history
`world.bounds` is a normal bounds object with min and max coordinates instead of height and width.
  • Loading branch information
Rantanen committed Apr 2, 2016
1 parent a5b535d commit a20a9fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/collision/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ var Common = require('../core/Common');
continue;

// don't update out of world bodies
if (body.bounds.max.x < 0 || body.bounds.min.x > world.bounds.width
|| body.bounds.max.y < 0 || body.bounds.min.y > world.bounds.height)
if (body.bounds.max.x < world.bounds.min.x || body.bounds.min.x > world.bounds.max.x
|| body.bounds.max.y < world.bounds.min.y || body.bounds.min.y > world.bounds.max.y)
continue;

var newRegion = _getRegion(grid, body);
Expand Down

0 comments on commit a20a9fb

Please sign in to comment.