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 @@ -445,6 +445,26 @@ static void RewriteHistory(
445
445
) ;
446
446
}
447
447
448
+ // modify base OnTeleport to NOT reset lastDe/Serialized,
449
+ // otherwise delta serialization breaks on teleport.
450
+ protected override void OnTeleport ( Vector3 destination )
451
+ {
452
+ // set the new position.
453
+ // interpolation will automatically continue.
454
+ target . position = destination ;
455
+
456
+ // reset interpolation to immediately jump to the new position.
457
+ // do not call Reset() here, this would cause delta compression to
458
+ // get out of sync for NetworkTransformReliable because NTReliable's
459
+ // 'override Reset()' resets lastDe/SerializedPosition:
460
+ // https://github.com/MirrorNetworking/Mirror/issues/3588
461
+ // because client's next OnSerialize() will delta compress,
462
+ // but server's last delta will have been reset, causing offsets.
463
+ //
464
+ // instead, simply clear snapshots.
465
+ base . ResetState ( ) ; // ! OVERWRITE ! only call base.ResetState, don't reset deltas!
466
+ }
467
+
448
468
// reset state for next session.
449
469
// do not ever call this during a session (i.e. after teleport).
450
470
// calling this will break delta compression.
You can’t perform that action at this time.
0 commit comments