From a20a9fbd1c39cdac73c002fca1da9ac8ffdfb807 Mon Sep 17 00:00:00 2001 From: Mikko Rantanen Date: Sat, 2 Apr 2016 13:11:26 +0300 Subject: [PATCH] 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. --- src/collision/Grid.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/collision/Grid.js b/src/collision/Grid.js index 300649b6..9d466df4 100644 --- a/src/collision/Grid.js +++ b/src/collision/Grid.js @@ -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);