This commit is contained in:
RandomityGuy 2024-06-24 01:11:00 +05:30
parent 5a8eab9aff
commit c830d417f1
4 changed files with 27 additions and 20 deletions

View file

@ -2172,6 +2172,10 @@ class Marble extends GameObject {
playedSounds = [];
advancePhysics(timeState, move, collisionWorld, pathedInteriors);
for (pi in pathedInteriors) {
pi.update(timeState);
}
// physicsAccumulator += timeState.dt;
// while (physicsAccumulator > 0.032) {

View file

@ -139,6 +139,7 @@ class PathedInterior extends InteriorObject {
public function computeNextPathStep(timeDelta:Float) {
stopped = false;
prevPosition = this.position.clone();
if (currentTime == targetTime) {
velocity.set(0, 0, 0);
this.collider.velocity.set(0, 0, 0);
@ -177,6 +178,7 @@ class PathedInterior extends InteriorObject {
return;
if (this.velocity.length() == 0)
return;
velocity.w = 0;
var newp = position.add(velocity.multiply(timeDelta));
var tform = this.getAbsPos().clone();
tform.setPosition(newp);

View file

@ -96,26 +96,26 @@ class CollisionEntity implements IOctreeObject implements IBVHObject {
if (this.transform.equal(transform))
return;
// Speedup
if (this.fastTransform && Util.mat3x3equal(this.transform, transform)) {
var oldPos = this.transform.getPosition();
var newPos = transform.getPosition();
this.transform.setPosition(newPos);
this.invTransform = this.transform.getInverse();
if (this.boundingBox == null)
generateBoundingBox();
else {
this.boundingBox.xMin += newPos.x - oldPos.x;
this.boundingBox.xMax += newPos.x - oldPos.x;
this.boundingBox.yMin += newPos.y - oldPos.y;
this.boundingBox.yMax += newPos.y - oldPos.y;
this.boundingBox.zMin += newPos.z - oldPos.z;
this.boundingBox.zMax += newPos.z - oldPos.z;
}
} else {
this.transform.load(transform);
this.invTransform = transform.getInverse();
generateBoundingBox();
}
// if (this.fastTransform && Util.mat3x3equal(this.transform, transform)) {
// var oldPos = this.transform.getPosition();
// var newPos = transform.getPosition();
// this.transform.setPosition(newPos);
// this.invTransform = this.transform.getInverse();
// if (this.boundingBox == null)
// generateBoundingBox();
// else {
// this.boundingBox.xMin += newPos.x - oldPos.x;
// this.boundingBox.xMax += newPos.x - oldPos.x;
// this.boundingBox.yMin += newPos.y - oldPos.y;
// this.boundingBox.yMax += newPos.y - oldPos.y;
// this.boundingBox.zMin += newPos.z - oldPos.z;
// this.boundingBox.zMax += newPos.z - oldPos.z;
// }
// } else {
this.transform.load(transform);
this.invTransform = transform.getInverse();
generateBoundingBox();
// }
_transformKey++;
}

View file

@ -326,6 +326,7 @@ class RewindFrame {
currentUp.z = br.readDouble();
lastContactNormal.x = br.readDouble();
lastContactNormal.y = br.readDouble();
lastContactNormal.z = br.readDouble();
mpStates = [];
var mpStates_len = br.readInt16();
for (i in 0...mpStates_len) {