@@ -50,53 +50,17 @@ var GetOverlapY = function (body1, body2, overlapOnly, bias)
5050 overlap = 0 ;
5151 }
5252 }
53-
54- // Resets the overlapY to zero if there is no overlap, or to the actual pixel value if there is
55- body1 . overlapY = overlap ;
56- body2 . overlapY = overlap ;
57-
58- return [ overlap , topFace ] ;
59-
60- /*
61- var body1Down = (body1.deltaY() > body2.deltaY());
62-
63- if (body1.deltaY() === body2.deltaY())
53+ if ( overlap > maxOverlap && ! overlapOnly )
6454 {
65- // Neither of them has a faster velocity, but we still need to separate them,
66- // so try to figure it out based on overlap depth
67- var distance1 = body1.bottom - body2.y;
68- var distance2 = body2.bottom - body1.y;
69-
70- body1Down = (distance1 < distance2);
71- }
72-
73- if (body1Down || body2.blocked.down)
74- {
75- // body1 is moving down and body2 is either moving up, moving slower than body1, or static
76- overlap = body1.bottom - body2.y;
77-
78- if ((overlap > maxOverlap && !overlapOnly) || !body1.checkCollision.down || !body2.checkCollision.up)
79- {
80- overlap = 0;
81- }
82- }
83- else
84- {
85- // body1 is moving up and body2 is either moving down, moving slower than body1, or static
86- overlap = body1.y - body2.bottom;
87-
88- if ((-overlap > maxOverlap && !overlapOnly) || !body1.checkCollision.up || !body2.checkCollision.down)
89- {
90- overlap = 0;
91- }
55+ body1 . embedded = true ;
56+ body2 . embedded = true ;
9257 }
9358
9459 // Resets the overlapY to zero if there is no overlap, or to the actual pixel value if there is
9560 body1 . overlapY = overlap ;
9661 body2 . overlapY = overlap ;
9762
98- return [ overlap, body1Down ];
99- */
63+ return [ overlap , topFace ] ;
10064} ;
10165
10266module . exports = GetOverlapY ;
0 commit comments