mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 23:20:59 +00:00
Don't force body position at this point
This commit is contained in:
parent
290ef210f4
commit
bfdd039bf4
1 changed files with 4 additions and 33 deletions
|
@ -4,7 +4,6 @@
|
|||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
*/
|
||||
|
||||
// var CONST = require('./const');
|
||||
var IntersectsRect = require('./IntersectsRect');
|
||||
|
||||
/**
|
||||
|
@ -26,18 +25,12 @@ var CheckOverlapY = function (body1, body2, padding)
|
|||
{
|
||||
if (padding === undefined) { padding = 0; }
|
||||
|
||||
// var body1Immovable = (body1.physicsType === CONST.STATIC_BODY || body1.immovable);
|
||||
// var body2Immovable = (body2.physicsType === CONST.STATIC_BODY || body2.immovable);
|
||||
|
||||
var distance1 = body1.bottom - body2.y;
|
||||
var distance2 = body2.bottom - body1.y;
|
||||
|
||||
var prevDistance1 = (body1.prev.y + body1.height) - body2.prev.y;
|
||||
var prevDistance2 = (body2.prev.y + body2.height) - body1.prev.y;
|
||||
|
||||
// var worldBlocked1 = body1.worldBlocked;
|
||||
// var worldBlocked2 = body2.worldBlocked;
|
||||
|
||||
var topFace = (distance1 > distance2 && prevDistance1 > prevDistance2);
|
||||
|
||||
var intersects = IntersectsRect(body1, body2, padding);
|
||||
|
@ -49,19 +42,8 @@ var CheckOverlapY = function (body1, body2, padding)
|
|||
body1.setTouchingDown();
|
||||
body2.setTouchingUp();
|
||||
|
||||
body1.setBlockedDown(body2);
|
||||
body2.setBlockedUp(body1);
|
||||
|
||||
// World blocks cannot be penetrated
|
||||
// if (worldBlocked2.down || body2Immovable)
|
||||
// {
|
||||
// body1.setWorldBlockedDown();
|
||||
// }
|
||||
|
||||
// if (worldBlocked1.up || body1Immovable)
|
||||
// {
|
||||
// body2.setWorldBlockedUp();
|
||||
// }
|
||||
body1.setBlockedDown(body2, false);
|
||||
body2.setBlockedUp(body1, false);
|
||||
}
|
||||
}
|
||||
else if (intersects && topFace)
|
||||
|
@ -71,19 +53,8 @@ var CheckOverlapY = function (body1, body2, padding)
|
|||
body1.setTouchingUp();
|
||||
body2.setTouchingDown();
|
||||
|
||||
body1.setBlockedUp(body2);
|
||||
body2.setBlockedDown(body1);
|
||||
|
||||
// World blocks cannot be penetrated
|
||||
// if (worldBlocked2.up || body2Immovable)
|
||||
// {
|
||||
// body1.setWorldBlockedUp();
|
||||
// }
|
||||
|
||||
// if (worldBlocked1.down || body1Immovable)
|
||||
// {
|
||||
// body2.setWorldBlockedDown();
|
||||
// }
|
||||
body1.setBlockedUp(body2, false);
|
||||
body2.setBlockedDown(body1, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue