From df669cca1717377d9f29163bc0cebdf39446a5d8 Mon Sep 17 00:00:00 2001 From: RandomityGuy <31925790+RandomityGuy@users.noreply.github.com> Date: Sun, 14 May 2023 14:03:01 +0530 Subject: [PATCH] minor fixes --- src/Marble.hx | 7 +++++-- src/PathedInterior.hx | 8 ++++---- src/gui/PlayMissionGui.hx | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Marble.hx b/src/Marble.hx index bc36140f..560a98ef 100644 --- a/src/Marble.hx +++ b/src/Marble.hx @@ -696,14 +696,14 @@ class Marble extends GameObject { done = true; for (contact in contacts) { - contact.velocity = new Vector(); + contact.velocity.set(0, 0, 0); } for (interior in pi) { interior.setStopped(); } } - } while (!done); + } while (!done && itersIn < 1e4); // Maximum limit pls // if (this.velocity.lengthSq() < 625) { var gotOne = false; var dir = new Vector(0, 0, 0); @@ -1710,6 +1710,9 @@ class Marble extends GameObject { contactTime += timeStep; timeRemaining -= timeStep; + + if (tdiff == 0 || it > 10) + break; } while (true); this.queuedContacts = []; diff --git a/src/PathedInterior.hx b/src/PathedInterior.hx index 605c80d6..79785ad2 100644 --- a/src/PathedInterior.hx +++ b/src/PathedInterior.hx @@ -171,7 +171,7 @@ class PathedInterior extends InteriorObject { // if (!stopped) // this.currentTime = timeState.currentAttemptTime; - velocity = position.sub(this.prevPosition).multiply(1 / timeState.dt); + velocity.set((position.x - prevPosition.x) / timeState.dt, (position.y - prevPosition.y) / timeState.dt, (position.z - prevPosition.z) / timeState.dt); this.updatePosition(); } @@ -187,7 +187,7 @@ class PathedInterior extends InteriorObject { var transform = this.getTransformAtTime(this.getInternalTime(thisTime)); var position = transform.getPosition(); - velocity = position.sub(this.currentPosition).multiply(1 / dt); + velocity.set((position.x - currentPosition.x) / dt, (position.y - currentPosition.y) / dt, (position.z - currentPosition.z) / dt); this.collider.velocity = velocity; } @@ -198,7 +198,7 @@ class PathedInterior extends InteriorObject { changeTime: changeTime, prevPosition: prevPosition, currentPosition: currentPosition, - velocity: velocity + velocity: velocity.clone() }; } @@ -208,7 +208,7 @@ class PathedInterior extends InteriorObject { this.changeTime = this.previousState.changeTime; this.prevPosition = this.previousState.prevPosition; this.currentPosition = this.previousState.currentPosition; - this.velocity = this.previousState.velocity; + this.velocity = this.previousState.velocity.clone(); this.collider.velocity = this.velocity; // this.updatePosition(); } diff --git a/src/gui/PlayMissionGui.hx b/src/gui/PlayMissionGui.hx index 7804cbb7..4a4dded6 100644 --- a/src/gui/PlayMissionGui.hx +++ b/src/gui/PlayMissionGui.hx @@ -888,7 +888,7 @@ class PlayMissionGui extends GuiImage { } pmPreview.addChild(pmEgg); - pmEgg.render(MarbleGame.canvas.scene2d); + pmEgg.render(MarbleGame.canvas.scene2d, @:privateAccess pmPreview._flow); } // if (currentCategory != "custom"