Revert "Testing sleep static fixes"

This reverts commit f0d5280cf8.
This commit is contained in:
Richard Davey 2023-11-10 14:58:02 +00:00
parent 9fe9f4536b
commit 1cae6391b3
2 changed files with 13 additions and 44 deletions

View file

@ -246,10 +246,6 @@ var Body = require('./Body');
var position = Common.indexOf(composite.bodies, body);
if (position !== -1) {
Composite.removeBodyAt(composite, position);
// remove sleeping to allow pair removal
body.isSleeping = false;
body.sleepCounter = 0;
}
if (deep) {

View file

@ -53,8 +53,6 @@ var Common = require('../core/Common');
collisionActiveIndex = 0,
collision,
pair,
bodyA,
bodyB,
i;
for (i = 0; i < collisionsLength; i++) {
@ -92,36 +90,11 @@ var Common = require('../core/Common');
pair = pairsList[i];
if (pair.timeUpdated < timestamp) {
bodyA = pair.collision.bodyA;
bodyB = pair.collision.bodyB;
// if ((bodyA.isSleeping && bodyB.isSleeping) || bodyA.isStatic || bodyB.isStatic)
// {
// continue;
// }
// keep pair if it is sleeping but not both static
// if ((bodyA.isSleeping || bodyA.isStatic) || (bodyB.isSleeping || bodyB.isStatic) && !(bodyA.isStatic && bodyB.isStatic)) {
// pairSetActive(pair, true, timestamp);
// continue;
// }
// pairSetActive(pair, false, timestamp);
// collisionEnd[collisionEndIndex++] = pair;
// keep pair if it is sleeping but not both static
// if ((bodyA.isSleeping || bodyA.isStatic) && (bodyB.isSleeping || bodyB.isStatic)
// && !(bodyA.isStatic && bodyB.isStatic)) {
// continue;
// }
// remove inactive pairs
// if (!bodyA.isSleeping && !bodyB.isSleeping && !bodyA.isStatic && !bodyB.isStatic) {
if ((!bodyA.isSleeping || !bodyA.isStatic) && (!bodyB.isSleeping || !bodyB.isStatic)) {
console.log('deleted pair', bodyA, bodyB);
pairSetActive(pair, false, timestamp);
collisionEnd[collisionEndIndex++] = pair;
// remove inactive pairs
if (!pair.collision.bodyA.isSleeping && !pair.collision.bodyB.isSleeping) {
delete pairsTable[pair.id];
}
} else {