Skip to content

Commit

Permalink
GetOverlapX/Y now use the calculated delta values, not the deltaX/Y m…
Browse files Browse the repository at this point in the history
…ethods
  • Loading branch information
photonstorm committed Jun 1, 2018
1 parent 4ad7993 commit 329c926
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/physics/arcade/GetOverlapX.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ var GetOverlapX = function (body1, body2, overlapOnly, bias)
var overlap = 0;
var maxOverlap = body1.deltaAbsX() + body2.deltaAbsX() + bias;

if (body1.deltaX() === 0 && body2.deltaX() === 0)
if (body1._dx === 0 && body2._dx === 0)
{
// They overlap but neither of them are moving
body1.embedded = true;
body2.embedded = true;
}
else if (body1.deltaX() > body2.deltaX())
else if (body1._dx > body2._dx)
{
// Body1 is moving right and / or Body2 is moving left
overlap = body1.right - body2.x;
Expand All @@ -45,7 +45,7 @@ var GetOverlapX = function (body1, body2, overlapOnly, bias)
body2.touching.left = true;
}
}
else if (body1.deltaX() < body2.deltaX())
else if (body1._dx < body2._dx)
{
// Body1 is moving left and/or Body2 is moving right
overlap = body1.x - body2.width - body2.x;
Expand Down
6 changes: 3 additions & 3 deletions src/physics/arcade/GetOverlapY.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ var GetOverlapY = function (body1, body2, overlapOnly, bias)
var overlap = 0;
var maxOverlap = body1.deltaAbsY() + body2.deltaAbsY() + bias;

if (body1.deltaY() === 0 && body2.deltaY() === 0)
if (body1._dy === 0 && body2._dy === 0)
{
// They overlap but neither of them are moving
body1.embedded = true;
body2.embedded = true;
}
else if (body1.deltaY() > body2.deltaY())
else if (body1._dy > body2._dy)
{
// Body1 is moving down and/or Body2 is moving up
overlap = body1.bottom - body2.y;
Expand All @@ -45,7 +45,7 @@ var GetOverlapY = function (body1, body2, overlapOnly, bias)
body2.touching.up = true;
}
}
else if (body1.deltaY() < body2.deltaY())
else if (body1._dy < body2._dy)
{
// Body1 is moving up and/or Body2 is moving down
overlap = body1.y - body2.bottom;
Expand Down

1 comment on commit 329c926

@photonstorm
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Phaser. There might be relevant details there:

https://phaser.discourse.group/t/bug-regression-riding-a-moving-body-ignore-collisions/6827/4

Please sign in to comment.