mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix spectate bug
This commit is contained in:
parent
2416a7119e
commit
87ff14b6b8
3 changed files with 22 additions and 13 deletions
|
|
@ -389,7 +389,7 @@ class CameraController extends Object {
|
|||
return;
|
||||
}
|
||||
|
||||
var marblePosition = level.marbles[spectateMarbleIndex].getAbsPos().getPosition();
|
||||
var marblePosition = @:privateAccess level.marbles[spectateMarbleIndex].lastRenderPos;
|
||||
var up = new Vector(0, 0, 1);
|
||||
up.transform(orientationQuat.toMatrix());
|
||||
var directionVector = new Vector(1, 0, 0);
|
||||
|
|
|
|||
|
|
@ -2123,7 +2123,10 @@ class Marble extends GameObject {
|
|||
}
|
||||
physicsAccumulator += timeState.dt;
|
||||
|
||||
if (this.controllable && this.level != null && !this.level.rewinding) {
|
||||
if (this.controllable
|
||||
&& this.level != null
|
||||
&& !this.level.rewinding
|
||||
&& !(Net.clientSpectate || Net.hostSpectate)) { // Separately update the camera if spectate
|
||||
// this.camera.startCenterCamera();
|
||||
this.camera.update(timeState.currentAttemptTime, timeState.dt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1506,26 +1506,28 @@ class MarbleWorld extends Scheduler {
|
|||
}
|
||||
// marble.unpackUpdate(ourMove);
|
||||
// needsPrediction |= 1 << Net.clientId;
|
||||
if (ourMoveStruct != null) {
|
||||
var ourPred = predictions.retrieveState(marble, ourMoveStruct.timeState.ticks);
|
||||
if (ourPred != null) {
|
||||
if (ourPred.getError(ourMove) > 0.01) {
|
||||
if (!Net.clientSpectate) {
|
||||
if (ourMoveStruct != null) {
|
||||
var ourPred = predictions.retrieveState(marble, ourMoveStruct.timeState.ticks);
|
||||
if (ourPred != null) {
|
||||
if (ourPred.getError(ourMove) > 0.01) {
|
||||
// trace('Desync for tick ${ourMoveStruct.timeState.ticks}');
|
||||
marble.unpackUpdate(ourMove);
|
||||
needsPrediction |= 1 << Net.clientId;
|
||||
predictions.clearStatesAfterTick(marble, ourMoveStruct.timeState.ticks);
|
||||
}
|
||||
} else {
|
||||
// trace('Desync for tick ${ourMoveStruct.timeState.ticks}');
|
||||
marble.unpackUpdate(ourMove);
|
||||
needsPrediction |= 1 << Net.clientId;
|
||||
predictions.clearStatesAfterTick(marble, ourMoveStruct.timeState.ticks);
|
||||
}
|
||||
} else {
|
||||
// trace('Desync for tick ${ourMoveStruct.timeState.ticks}');
|
||||
// trace('Desync in General');
|
||||
marble.unpackUpdate(ourMove);
|
||||
needsPrediction |= 1 << Net.clientId;
|
||||
predictions.clearStatesAfterTick(marble, ourMoveStruct.timeState.ticks);
|
||||
// predictions.clearStatesAfterTick(marble, ourMoveStruct.timeState.ticks);
|
||||
}
|
||||
} else {
|
||||
// trace('Desync in General');
|
||||
marble.unpackUpdate(ourMove);
|
||||
needsPrediction |= 1 << Net.clientId;
|
||||
// predictions.clearStatesAfterTick(marble, ourMoveStruct.timeState.ticks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1968,6 +1970,10 @@ class MarbleWorld extends Scheduler {
|
|||
for (client => marble in clientMarbles) {
|
||||
marble.updateClient(timeState, this.pathedInteriors);
|
||||
}
|
||||
if (Net.clientSpectate || Net.hostSpectate) {
|
||||
// this.camera.startCenterCamera();
|
||||
marble.camera.update(timeState.currentAttemptTime, timeState.dt);
|
||||
}
|
||||
} else {
|
||||
for (marble in marbles) {
|
||||
marble.update(timeState, collisionWorld, this.pathedInteriors);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue