diff --git a/marblegame.hl b/marblegame.hl index d7dc18db..704128ef 100644 Binary files a/marblegame.hl and b/marblegame.hl differ diff --git a/src/Marble.hx b/src/Marble.hx index e9174920..2314e8c4 100644 --- a/src/Marble.hx +++ b/src/Marble.hx @@ -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);