Merge pull request #5242 from samme/fix/collide-with-friction

Fix collisions for objects moved by friction
This commit is contained in:
Richard Davey 2020-08-03 10:27:01 +01:00 committed by GitHub
commit 8db2543e27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -64,6 +64,7 @@ var SeparateX = function (body1, body2, overlapOnly, bias)
if (body2.moves)
{
body1.y += (body2.y - body2.prev.y) * body2.friction.y;
body1._dy = body1.y - body1.prev.y;
}
}
else
@ -75,6 +76,7 @@ var SeparateX = function (body1, body2, overlapOnly, bias)
if (body1.moves)
{
body2.y += (body1.y - body1.prev.y) * body1.friction.y;
body2._dy = body2.y - body2.prev.y;
}
}

View file

@ -64,6 +64,7 @@ var SeparateY = function (body1, body2, overlapOnly, bias)
if (body2.moves)
{
body1.x += (body2.x - body2.prev.x) * body2.friction.x;
body1._dx = body1.x - body1.prev.x;
}
}
else
@ -75,6 +76,7 @@ var SeparateY = function (body1, body2, overlapOnly, bias)
if (body1.moves)
{
body2.x += (body1.x - body1.prev.x) * body1.friction.x;
body2._dx = body2.x - body2.prev.x;
}
}