mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-27 13:11:42 +00:00
ccd fix yet again
This commit is contained in:
parent
e69a83f2c6
commit
1c5f6c1470
2 changed files with 18 additions and 18 deletions
BIN
marblegame.hl
BIN
marblegame.hl
Binary file not shown.
|
|
@ -811,11 +811,6 @@ class Marble extends GameObject {
|
||||||
if (timeRemaining < timeStep)
|
if (timeRemaining < timeStep)
|
||||||
timeStep = timeRemaining;
|
timeStep = timeRemaining;
|
||||||
|
|
||||||
var tempState = timeState.clone();
|
|
||||||
tempState.dt = timeStep;
|
|
||||||
|
|
||||||
it++;
|
|
||||||
|
|
||||||
if (this.controllable) {
|
if (this.controllable) {
|
||||||
for (interior in pathedInteriors) {
|
for (interior in pathedInteriors) {
|
||||||
interior.pushTickState();
|
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);
|
this.findContacts(collisionWorld, tempState);
|
||||||
var cmf = this.computeMoveForces(m);
|
var cmf = this.computeMoveForces(m);
|
||||||
var isCentered:Bool = cmf.result;
|
var isCentered:Bool = cmf.result;
|
||||||
|
|
@ -842,18 +854,6 @@ class Marble extends GameObject {
|
||||||
this._contactTime += timeStep;
|
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;
|
piTime += timeStep;
|
||||||
if (this.controllable) {
|
if (this.controllable) {
|
||||||
for (interior in pathedInteriors) {
|
for (interior in pathedInteriors) {
|
||||||
|
|
@ -910,7 +910,7 @@ class Marble extends GameObject {
|
||||||
contactTime += timeStep;
|
contactTime += timeStep;
|
||||||
|
|
||||||
timeRemaining -= timeStep;
|
timeRemaining -= timeStep;
|
||||||
} while (it <= 10);
|
} while (true);
|
||||||
this.queuedContacts = [];
|
this.queuedContacts = [];
|
||||||
|
|
||||||
this.updateRollSound(contactTime / timeState.dt, this._slipAmount);
|
this.updateRollSound(contactTime / timeState.dt, this._slipAmount);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue