replay fixes and network last contact normal

This commit is contained in:
RandomityGuy 2024-11-02 01:21:53 +05:30
parent 96b5136c92
commit 11d06784e4
3 changed files with 9 additions and 0 deletions

View file

@ -1883,6 +1883,7 @@ class Marble extends GameObject {
marbleUpdate.position = this.newPos;
marbleUpdate.velocity = this.velocity;
marbleUpdate.omega = this.omega;
marbleUpdate.lastContactNormal = this.lastContactNormal;
marbleUpdate.move = move;
marbleUpdate.moveQueueSize = this.connection != null ? this.connection.moveManager.getQueueSize() : 255;
marbleUpdate.blastAmount = this.blastTicks;
@ -1913,6 +1914,7 @@ class Marble extends GameObject {
this.collider.transform.setPosition(p.position);
this.velocity = p.velocity;
this.omega = p.omega;
this.lastContactNormal = p.lastContactNormal;
this.blastTicks = p.blastAmount;
this.blastUseTick = p.blastTick;
this.helicopterUseTick = p.heliTick;
@ -2161,6 +2163,7 @@ class Marble extends GameObject {
if (this.controllable && this.level.isWatching) {
move = new Move();
move.d = new Vector(0, 0);
if (this.level.replay.currentPlaybackFrame.marbleStateFlags.has(Jumped))
move.jump = true;
if (this.level.replay.currentPlaybackFrame.marbleStateFlags.has(UsedPowerup))

View file

@ -85,6 +85,7 @@ class ReplayFrame {
interpFrame.marbleVelocity = Util.lerpThreeVectors(this.marbleVelocity, next.marbleVelocity, t);
interpFrame.marbleOrientation = new Quat();
interpFrame.marbleOrientation.slerp(this.marbleOrientation, next.marbleOrientation, t);
interpFrame.marbleOrientation.normalize();
interpFrame.marbleAngularVelocity = Util.lerpThreeVectors(this.marbleAngularVelocity, next.marbleAngularVelocity, t);
}

View file

@ -58,6 +58,7 @@ class MarbleUpdatePacket implements NetPacket {
var position:Vector;
var velocity:Vector;
var omega:Vector;
var lastContactNormal:Vector;
var blastAmount:Int;
var blastTick:Int;
var megaTick:Int;
@ -84,6 +85,9 @@ class MarbleUpdatePacket implements NetPacket {
b.writeFloat(omega.x);
b.writeFloat(omega.y);
b.writeFloat(omega.z);
b.writeFloat(lastContactNormal.x);
b.writeFloat(lastContactNormal.y);
b.writeFloat(lastContactNormal.z);
b.writeInt(blastAmount, 11);
if (netFlags & MarbleNetFlags.DoBlast > 0) {
b.writeFlag(true);
@ -134,6 +138,7 @@ class MarbleUpdatePacket implements NetPacket {
position = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
velocity = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
omega = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
lastContactNormal = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
blastAmount = b.readInt(11);
this.netFlags = 0;
if (b.readFlag()) {