mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-12-24 17:02:50 +00:00
Reduce physics timestep to fix internal edge collision lmao
This commit is contained in:
parent
08f6fefda1
commit
bd33ce408a
5 changed files with 8 additions and 7 deletions
BIN
marblegame.hl
BIN
marblegame.hl
Binary file not shown.
|
|
@ -485,7 +485,7 @@ class Marble extends GameObject {
|
|||
var soFar = 0.0;
|
||||
for (k in 0...contacts.length) {
|
||||
var dist = this._radius - contacts[k].contactDistance;
|
||||
var timeToSeparate = 0.1;
|
||||
var timeToSeparate = 0.016;
|
||||
if (dist >= 0) {
|
||||
var f1 = this.velocity.sub(contacts[k].velocity).add(dir.multiply(soFar)).dot(contacts[k].normal);
|
||||
var f2 = timeToSeparate * f1;
|
||||
|
|
@ -808,21 +808,21 @@ class Marble extends GameObject {
|
|||
if (timeRemaining <= 0)
|
||||
break;
|
||||
|
||||
var timeStep = 0.008;
|
||||
var timeStep = 0.002;
|
||||
if (timeRemaining < timeStep)
|
||||
timeStep = timeRemaining;
|
||||
|
||||
if (this.controllable) {
|
||||
for (interior in pathedInteriors) {
|
||||
interior.pushTickState();
|
||||
interior.recomputeVelocity(piTime + timeStep * 2, timeStep * 2);
|
||||
interior.recomputeVelocity(piTime + timeStep * 4, timeStep * 4);
|
||||
}
|
||||
}
|
||||
|
||||
var intersectT = this.getIntersectionTime(timeStep, velocity);
|
||||
|
||||
if (intersectT < timeStep && intersectT >= 0.001) {
|
||||
// intersectT *= 0.8; // We uh tick the shit to not actually at the contact time cause bruh
|
||||
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));
|
||||
|
|
|
|||
|
|
@ -998,7 +998,8 @@ class MarbleWorld extends Scheduler {
|
|||
return q;
|
||||
}
|
||||
|
||||
var quatChange = getRotQuat(oldUp, vec);
|
||||
var quatChange = new Quat();
|
||||
quatChange.initMoveTo(oldUp, vec);
|
||||
// Instead of calculating the new quat from nothing, calculate it from the last one to guarantee the shortest possible rotation.
|
||||
// quatChange.initMoveTo(oldUp, vec);
|
||||
quatChange.multiply(quatChange, currentQuat);
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class CollisionEntity implements IOctreeObject {
|
|||
|
||||
var supportVec = surface.support(normal, tform);
|
||||
if (!(supportVec.equals(v0) || supportVec.equals(v) || supportVec.equals(v2))) {
|
||||
normal = surfacenormal;
|
||||
// normal = surfacenormal;
|
||||
}
|
||||
|
||||
// We find the normal that is closest to the surface normal, sort of fixes weird edge cases of when colliding with
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ class EndGameGui extends GuiControl {
|
|||
leftColumn.extent = new Vector(208, 50);
|
||||
pg.addChild(leftColumn);
|
||||
|
||||
var elapsedTime = Math.max(timeState.currentAttemptTime - 5.5, 0);
|
||||
var elapsedTime = Math.max(timeState.currentAttemptTime - 3.5, 0);
|
||||
var bonusTime = Math.max(0, elapsedTime - timeState.gameplayClock);
|
||||
|
||||
var rightColumn = new GuiMLText(domcasual32, mlFontLoader);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue