Skip to content

Commit 70b500c

Browse files
authored
Merge pull request phaserjs#4519 from hizzd/master
Fixed separateCircle cause the position set NaN.
2 parents 725130b + 4aa3d9f commit 70b500c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/physics/arcade/World.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,8 +1467,8 @@ var World = new Class({
14671467
var dx = body1.position.x - body2.position.x;
14681468
var dy = body1.position.y - body2.position.y;
14691469
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;
1470+
var nx = ((body2.position.x - body1.position.x) / d) || 0;
1471+
var ny = ((body2.position.y - body1.position.y) / d) || 0;
14721472
var p = 2 * (body1.velocity.x * nx + body1.velocity.y * ny - body2.velocity.x * nx - body2.velocity.y * ny) / (body1.mass + body2.mass);
14731473

14741474
if (!body1.immovable)

0 commit comments

Comments
 (0)