Gravity stored in properties. Intersects padding removed.

This commit is contained in:
Richard Davey 2019-03-18 14:12:12 +00:00
parent 1306ad2f4a
commit 728a6da8e6

View file

@ -1187,18 +1187,13 @@ var World = new Class({
if (body.allowGravity) if (body.allowGravity)
{ {
var gravityX = (this.gravity.x + body.gravity.x) * delta; // var worldBlocked = body.worldBlocked;
var gravityY = (this.gravity.y + body.gravity.y) * delta;
if (gravityX < 0 && !body.worldBlocked.left || gravityX > 0 && !body.worldBlocked.right) body._gx = (this.gravity.x + body.gravity.x) * delta;
{ body._gy = (this.gravity.y + body.gravity.y) * delta;
velocityX += gravityX;
}
if (gravityY > 0 && !body.worldBlocked.down || gravityY < 0 && !body.worldBlocked.up) velocityX += body._gx;
{ velocityY += body._gy;
velocityY += gravityY;
}
} }
if (accelerationX) if (accelerationX)
@ -1610,7 +1605,7 @@ var World = new Class({
if (!body1.isCircle && !body2.isCircle) if (!body1.isCircle && !body2.isCircle)
{ {
return IntersectsRect(body1, body2, 1); return IntersectsRect(body1, body2);
} }
else if (body1.isCircle) else if (body1.isCircle)
{ {