We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 725130b + 4aa3d9f commit 70b500cCopy full SHA for 70b500c
1 file changed
src/physics/arcade/World.js
@@ -1467,8 +1467,8 @@ var World = new Class({
1467
var dx = body1.position.x - body2.position.x;
1468
var dy = body1.position.y - body2.position.y;
1469
var d = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
1470
- var nx = (body2.position.x - body1.position.x) / d;
1471
- var ny = (body2.position.y - body1.position.y) / d;
+ var nx = ((body2.position.x - body1.position.x) / d) || 0;
+ var ny = ((body2.position.y - body1.position.y) / d) || 0;
1472
var p = 2 * (body1.velocity.x * nx + body1.velocity.y * ny - body2.velocity.x * nx - body2.velocity.y * ny) / (body1.mass + body2.mass);
1473
1474
if (!body1.immovable)
0 commit comments