mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-03-06 12:01:02 +00:00
Fix some bugs, change the timestep, make collision CCD
This commit is contained in:
parent
7644c4c8de
commit
e562b8be0b
4 changed files with 14 additions and 9 deletions
|
|
@ -103,6 +103,8 @@ class DifBuilder {
|
|||
for (j in hull.surfaceStart...(hull.surfaceStart + hull.surfaceCount)) {
|
||||
var surfaceindex = geo.hullSurfaceIndices[j];
|
||||
var surface = geo.surfaces[surfaceindex];
|
||||
if (surface == null)
|
||||
continue;
|
||||
var planeindex = surface.planeIndex;
|
||||
|
||||
var planeFlipped = (planeindex & 0x8000) == 0x8000;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class Main extends hxd.App {
|
|||
override function init() {
|
||||
super.init();
|
||||
|
||||
var ltr = File.getContent("data/missions/beginner/movement.mis");
|
||||
var ltr = File.getContent("data/missions/advanced/acrobat.mis");
|
||||
var mfp = new MisParser(ltr);
|
||||
var mis = mfp.parse();
|
||||
|
||||
|
|
|
|||
|
|
@ -691,8 +691,8 @@ class Marble extends GameObject {
|
|||
if (timeRemaining <= 0)
|
||||
break;
|
||||
|
||||
var timeStep = 0.00800000037997961;
|
||||
if (timeRemaining < 0.00800000037997961)
|
||||
var timeStep = 0.002;
|
||||
if (timeRemaining < 0.002)
|
||||
timeStep = timeRemaining;
|
||||
|
||||
var tempState = timeState.clone();
|
||||
|
|
@ -774,9 +774,15 @@ class Marble extends GameObject {
|
|||
this.heldPowerup = null;
|
||||
}
|
||||
|
||||
if (this.controllable) {
|
||||
var tempTimeState = timeState.clone();
|
||||
tempState.currentAttemptTime = piTime;
|
||||
tempState.dt = timeStep;
|
||||
this.level.callCollisionHandlers(cast this, tempTimeState);
|
||||
}
|
||||
|
||||
timeRemaining -= timeStep;
|
||||
it++;
|
||||
} while (it <= 10);
|
||||
} while (true);
|
||||
this.queuedContacts = [];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -593,9 +593,6 @@ class MarbleWorld extends Scheduler {
|
|||
this.particleManager.update(1000 * timeState.timeSinceLoad, dt);
|
||||
this.playGui.update(timeState);
|
||||
|
||||
if (this.marble != null) {
|
||||
callCollisionHandlers(marble);
|
||||
}
|
||||
this.updateTexts();
|
||||
}
|
||||
|
||||
|
|
@ -677,7 +674,7 @@ class MarbleWorld extends Scheduler {
|
|||
this.playGui.formatGemCounter(this.gemCount, this.totalGems);
|
||||
}
|
||||
|
||||
function callCollisionHandlers(marble:Marble) {
|
||||
public function callCollisionHandlers(marble:Marble, timeState:TimeState) {
|
||||
var contacts = this.collisionWorld.radiusSearch(marble.getAbsPos().getPosition(), marble._radius);
|
||||
var newImmunity = [];
|
||||
var calledShapes = [];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue