When the Matter World creates its wall bounds, the left and right walls now extend further up and down than before, so that in a 4-wall setting there are no gaps in the corners, which previously allowed for fast moving objects that hit a corner intersection point to sometimes travel through it.

This commit is contained in:
Richard Davey 2019-02-09 16:27:20 +00:00
parent fd8d75ab02
commit 0ab61ac6de
2 changed files with 3 additions and 2 deletions

View file

@ -29,6 +29,7 @@ The following changes all effect the Matter JS Pointer Constraint class:
* `KeyboardPlugin.time` has moved from being a property to being a getter, which returns the time from the InputManager. * `KeyboardPlugin.time` has moved from being a property to being a getter, which returns the time from the InputManager.
* The `scale` property has been added to the `Scene` class (thanks @strangeweekend) * The `scale` property has been added to the `Scene` class (thanks @strangeweekend)
* `Matter.World.remove` now uses the `Composite.remove` method internally. Previously, it used `Composite.removeBody` which only allowed it to remove bodies from the simulation. Now, it can remove any type of Matter object. * `Matter.World.remove` now uses the `Composite.remove` method internally. Previously, it used `Composite.removeBody` which only allowed it to remove bodies from the simulation. Now, it can remove any type of Matter object.
* When the Matter World creates its wall bounds, the left and right walls now extend further up and down than before, so that in a 4-wall setting there are no gaps in the corners, which previously allowed for fast moving objects that hit a corner intersection point to sometimes travel through it.
### Bug Fixes ### Bug Fixes

View file

@ -328,8 +328,8 @@ var World = new Class({
if (top === undefined) { top = true; } if (top === undefined) { top = true; }
if (bottom === undefined) { bottom = true; } if (bottom === undefined) { bottom = true; }
this.updateWall(left, 'left', x - thickness, y, thickness, height); this.updateWall(left, 'left', x - thickness, y - thickness, thickness, height + (thickness * 2));
this.updateWall(right, 'right', x + width, y, thickness, height); this.updateWall(right, 'right', x + width, y - thickness, thickness, height + (thickness * 2));
this.updateWall(top, 'top', x, y - thickness, width, thickness); this.updateWall(top, 'top', x, y - thickness, width, thickness);
this.updateWall(bottom, 'bottom', x, y + height, width, thickness); this.updateWall(bottom, 'bottom', x, y + height, width, thickness);