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 = []; playedSounds = [];
advancePhysics(timeState, move, collisionWorld, pathedInteriors); advancePhysics(timeState, move, collisionWorld, pathedInteriors);
for (pi in pathedInteriors) {
pi.update(timeState);
}
// physicsAccumulator += timeState.dt; // physicsAccumulator += timeState.dt;
// while (physicsAccumulator > 0.032) { // while (physicsAccumulator > 0.032) {

View file

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

View file

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

View file

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