replay fixes and network last contact normal

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

View file

@ -2068,6 +2068,7 @@ class Marble extends GameObject {
marbleUpdate.position = this.newPos; marbleUpdate.position = this.newPos;
marbleUpdate.velocity = this.velocity; marbleUpdate.velocity = this.velocity;
marbleUpdate.omega = this.omega; marbleUpdate.omega = this.omega;
marbleUpdate.lastContactNormal = this.lastContactNormal;
marbleUpdate.move = move; marbleUpdate.move = move;
marbleUpdate.moveQueueSize = this.connection != null ? this.connection.moveManager.getQueueSize() : 255; marbleUpdate.moveQueueSize = this.connection != null ? this.connection.moveManager.getQueueSize() : 255;
marbleUpdate.blastAmount = this.blastTicks; marbleUpdate.blastAmount = this.blastTicks;
@ -2106,6 +2107,7 @@ class Marble extends GameObject {
this.collider.transform.setPosition(p.position); this.collider.transform.setPosition(p.position);
this.velocity = p.velocity; this.velocity = p.velocity;
this.omega = p.omega; this.omega = p.omega;
this.lastContactNormal = p.lastContactNormal;
this.blastTicks = p.blastAmount; this.blastTicks = p.blastAmount;
this.blastUseTick = p.blastTick; this.blastUseTick = p.blastTick;
this.helicopterUseTick = p.heliTick; this.helicopterUseTick = p.heliTick;
@ -2384,6 +2386,8 @@ class Marble extends GameObject {
move = level.currentInputMoves[1].move; move = level.currentInputMoves[1].move;
if (this.level.isWatching) { if (this.level.isWatching) {
move = new Move();
move.d = new Vector(0, 0);
if (this.level.replay.currentPlaybackFrame.marbleStateFlags.has(Jumped)) if (this.level.replay.currentPlaybackFrame.marbleStateFlags.has(Jumped))
move.jump = true; move.jump = true;
if (this.level.replay.currentPlaybackFrame.marbleStateFlags.has(UsedPowerup)) 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.marbleVelocity = Util.lerpThreeVectors(this.marbleVelocity, next.marbleVelocity, t);
interpFrame.marbleOrientation = new Quat(); interpFrame.marbleOrientation = new Quat();
interpFrame.marbleOrientation.slerp(this.marbleOrientation, next.marbleOrientation, t); interpFrame.marbleOrientation.slerp(this.marbleOrientation, next.marbleOrientation, t);
interpFrame.marbleOrientation.normalize();
interpFrame.marbleAngularVelocity = Util.lerpThreeVectors(this.marbleAngularVelocity, next.marbleAngularVelocity, t); interpFrame.marbleAngularVelocity = Util.lerpThreeVectors(this.marbleAngularVelocity, next.marbleAngularVelocity, t);
} }

View file

@ -62,6 +62,7 @@ class MarbleUpdatePacket implements NetPacket {
var position:Vector; var position:Vector;
var velocity:Vector; var velocity:Vector;
var omega:Vector; var omega:Vector;
var lastContactNormal:Vector;
var blastAmount:Int; var blastAmount:Int;
var blastTick:Int; var blastTick:Int;
var megaTick:Int; var megaTick:Int;
@ -93,6 +94,9 @@ class MarbleUpdatePacket implements NetPacket {
b.writeFloat(omega.x); b.writeFloat(omega.x);
b.writeFloat(omega.y); b.writeFloat(omega.y);
b.writeFloat(omega.z); b.writeFloat(omega.z);
b.writeFloat(lastContactNormal.x);
b.writeFloat(lastContactNormal.y);
b.writeFloat(lastContactNormal.z);
b.writeInt(blastAmount, 11); b.writeInt(blastAmount, 11);
if (netFlags & MarbleNetFlags.DoBlast > 0) { if (netFlags & MarbleNetFlags.DoBlast > 0) {
b.writeFlag(true); b.writeFlag(true);
@ -172,6 +176,7 @@ class MarbleUpdatePacket implements NetPacket {
position = new Vector(b.readFloat(), b.readFloat(), b.readFloat()); position = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
velocity = 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()); omega = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
lastContactNormal = new Vector(b.readFloat(), b.readFloat(), b.readFloat());
blastAmount = b.readInt(11); blastAmount = b.readInt(11);
this.netFlags = 0; this.netFlags = 0;
if (b.readFlag()) { if (b.readFlag()) {