ccd fix yet again

This commit is contained in:
RandomityGuy 2021-07-02 21:31:15 +05:30
parent e69a83f2c6
commit 1c5f6c1470
2 changed files with 18 additions and 18 deletions

Binary file not shown.

View file

@ -811,11 +811,6 @@ class Marble extends GameObject {
if (timeRemaining < timeStep)
timeStep = timeRemaining;
var tempState = timeState.clone();
tempState.dt = timeStep;
it++;
if (this.controllable) {
for (interior in pathedInteriors) {
interior.pushTickState();
@ -823,6 +818,23 @@ class Marble extends GameObject {
}
}
var intersectT = this.getIntersectionTime(timeStep, velocity);
if (intersectT < timeStep && intersectT > 0.000001) {
// intersectT *= 0.8; // We uh tick the shit to not actually at the contact time cause bruh
// intersectT /= 2;
var diff = timeStep - intersectT;
// this.velocity = this.velocity.sub(A.multiply(diff));
// this.omega = this.omega.sub(a.multiply(diff));
timeStep = intersectT;
trace('CCD at ${intersectT}');
}
var tempState = timeState.clone();
tempState.dt = timeStep;
it++;
this.findContacts(collisionWorld, tempState);
var cmf = this.computeMoveForces(m);
var isCentered:Bool = cmf.result;
@ -842,18 +854,6 @@ class Marble extends GameObject {
this._contactTime += timeStep;
}
var intersectT = this.getIntersectionTime(timeStep, velocity);
if (intersectT < timeStep && intersectT > 0.000001) {
// intersectT *= 0.8; // We uh tick the shit to not actually at the contact time cause bruh
// intersectT /= 2;
var diff = timeStep - intersectT;
this.velocity = this.velocity.sub(A.multiply(diff));
this.omega = this.omega.sub(a.multiply(diff));
timeStep = intersectT;
trace('CCD at ${intersectT}');
}
piTime += timeStep;
if (this.controllable) {
for (interior in pathedInteriors) {
@ -910,7 +910,7 @@ class Marble extends GameObject {
contactTime += timeStep;
timeRemaining -= timeStep;
} while (it <= 10);
} while (true);
this.queuedContacts = [];
this.updateRollSound(contactTime / timeState.dt, this._slipAmount);