mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-02-11 08:45:53 +00:00
finally fix the fucking traplaunches PLUS uncapped delta T
This commit is contained in:
parent
c48f9e3a73
commit
0174909310
3 changed files with 12 additions and 5 deletions
BIN
marblegame.hl
BIN
marblegame.hl
Binary file not shown.
|
|
@ -35,7 +35,7 @@ class Main extends hxd.App {
|
|||
|
||||
override function update(dt:Float) {
|
||||
super.update(dt);
|
||||
marbleGame.update(hxd.Timer.dt);
|
||||
marbleGame.update(dt);
|
||||
// world.update(dt);
|
||||
fpsCounter.text = 'FPS: ${this.engine.fps}';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,18 +146,21 @@ class PathedInterior extends InteriorObject {
|
|||
// currentPosition: currentPosition,
|
||||
// velocity: velocity
|
||||
// };
|
||||
|
||||
var thisTime = timeState.currentAttemptTime;
|
||||
|
||||
if (stopped) {
|
||||
currentTime = stopTime;
|
||||
thisTime = stopTime;
|
||||
popTickState();
|
||||
}
|
||||
|
||||
var transform = this.getTransformAtTime(this.getInternalTime(timeState.currentAttemptTime));
|
||||
var transform = this.getTransformAtTime(this.getInternalTime(thisTime));
|
||||
|
||||
var position = transform.getPosition();
|
||||
this.prevPosition = this.currentPosition;
|
||||
this.currentPosition = position;
|
||||
if (!stopped) {
|
||||
this.stopTime = currentTime;
|
||||
this.stopTime = timeState.currentAttemptTime;
|
||||
pushTickState();
|
||||
}
|
||||
// if (!stopped)
|
||||
|
|
@ -175,9 +178,12 @@ class PathedInterior extends InteriorObject {
|
|||
}
|
||||
|
||||
public function recomputeVelocity(currentTime:Float, dt:Float) {
|
||||
var transform = this.getTransformAtTime(this.getInternalTime(currentTime));
|
||||
var thisTime = currentTime;
|
||||
|
||||
var transform = this.getTransformAtTime(this.getInternalTime(thisTime));
|
||||
var position = transform.getPosition();
|
||||
velocity = position.sub(this.currentPosition).multiply(1 / dt);
|
||||
this.collider.velocity = velocity;
|
||||
}
|
||||
|
||||
public function pushTickState() {
|
||||
|
|
@ -198,6 +204,7 @@ class PathedInterior extends InteriorObject {
|
|||
this.prevPosition = this.previousState.prevPosition;
|
||||
this.currentPosition = this.previousState.currentPosition;
|
||||
this.velocity = this.previousState.velocity;
|
||||
this.collider.velocity = this.velocity;
|
||||
// this.updatePosition();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue