mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-27 05:01:38 +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) {
|
override function update(dt:Float) {
|
||||||
super.update(dt);
|
super.update(dt);
|
||||||
marbleGame.update(hxd.Timer.dt);
|
marbleGame.update(dt);
|
||||||
// world.update(dt);
|
// world.update(dt);
|
||||||
fpsCounter.text = 'FPS: ${this.engine.fps}';
|
fpsCounter.text = 'FPS: ${this.engine.fps}';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,18 +146,21 @@ class PathedInterior extends InteriorObject {
|
||||||
// currentPosition: currentPosition,
|
// currentPosition: currentPosition,
|
||||||
// velocity: velocity
|
// velocity: velocity
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
var thisTime = timeState.currentAttemptTime;
|
||||||
|
|
||||||
if (stopped) {
|
if (stopped) {
|
||||||
currentTime = stopTime;
|
thisTime = stopTime;
|
||||||
popTickState();
|
popTickState();
|
||||||
}
|
}
|
||||||
|
|
||||||
var transform = this.getTransformAtTime(this.getInternalTime(timeState.currentAttemptTime));
|
var transform = this.getTransformAtTime(this.getInternalTime(thisTime));
|
||||||
|
|
||||||
var position = transform.getPosition();
|
var position = transform.getPosition();
|
||||||
this.prevPosition = this.currentPosition;
|
this.prevPosition = this.currentPosition;
|
||||||
this.currentPosition = position;
|
this.currentPosition = position;
|
||||||
if (!stopped) {
|
if (!stopped) {
|
||||||
this.stopTime = currentTime;
|
this.stopTime = timeState.currentAttemptTime;
|
||||||
pushTickState();
|
pushTickState();
|
||||||
}
|
}
|
||||||
// if (!stopped)
|
// if (!stopped)
|
||||||
|
|
@ -175,9 +178,12 @@ class PathedInterior extends InteriorObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function recomputeVelocity(currentTime:Float, dt:Float) {
|
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();
|
var position = transform.getPosition();
|
||||||
velocity = position.sub(this.currentPosition).multiply(1 / dt);
|
velocity = position.sub(this.currentPosition).multiply(1 / dt);
|
||||||
|
this.collider.velocity = velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pushTickState() {
|
public function pushTickState() {
|
||||||
|
|
@ -198,6 +204,7 @@ class PathedInterior extends InteriorObject {
|
||||||
this.prevPosition = this.previousState.prevPosition;
|
this.prevPosition = this.previousState.prevPosition;
|
||||||
this.currentPosition = this.previousState.currentPosition;
|
this.currentPosition = this.previousState.currentPosition;
|
||||||
this.velocity = this.previousState.velocity;
|
this.velocity = this.previousState.velocity;
|
||||||
|
this.collider.velocity = this.velocity;
|
||||||
// this.updatePosition();
|
// this.updatePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue