File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Assets/Mirror/Components/NetworkTransform Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -478,6 +478,26 @@ static void RewriteHistory(
478
478
) ;
479
479
}
480
480
481
+ // modify base OnTeleport to NOT reset lastDe/Serialized,
482
+ // otherwise delta serialization breaks on teleport.
483
+ protected override void OnTeleport ( Vector3 destination )
484
+ {
485
+ // set the new position.
486
+ // interpolation will automatically continue.
487
+ target . position = destination ;
488
+
489
+ // reset interpolation to immediately jump to the new position.
490
+ // do not call Reset() here, this would cause delta compression to
491
+ // get out of sync for NetworkTransformReliable because NTReliable's
492
+ // 'override Reset()' resets lastDe/SerializedPosition:
493
+ // https://github.com/MirrorNetworking/Mirror/issues/3588
494
+ // because client's next OnSerialize() will delta compress,
495
+ // but server's last delta will have been reset, causing offsets.
496
+ //
497
+ // instead, simply clear snapshots.
498
+ base . ResetState ( ) ; // ! OVERWRITE ! only call base.ResetState, don't reset deltas!
499
+ }
500
+
481
501
// reset state for next session.
482
502
// do not ever call this during a session (i.e. after teleport).
483
503
// calling this will break delta compression.
You can’t perform that action at this time.
0 commit comments