@@ -453,9 +453,6 @@ internal NetworkVariable<NetworkTransformState> ReplicatedNetworkState
453
453
// Used by integration test
454
454
private NetworkTransformState m_LastSentState ;
455
455
456
- // Used by the non-authoritative side to handle ending extrapolation
457
- private NetworkTransformState m_LastReceivedState ;
458
-
459
456
internal NetworkTransformState GetLastSentState ( )
460
457
{
461
458
return m_LastSentState ;
@@ -556,6 +553,8 @@ private void ResetInterpolatedStateToCurrentAuthoritativeState()
556
553
557
554
m_RotationInterpolator . ResetTo ( transform . rotation , serverTime ) ;
558
555
556
+ // TODO: (Create Jira Ticket) Synchronize local scale during NetworkObject synchronization
557
+ // (We will probably want to byte pack TransformData to offset the 3 float addition)
559
558
m_ScaleXInterpolator . ResetTo ( transform . localScale . x , serverTime ) ;
560
559
m_ScaleYInterpolator . ResetTo ( transform . localScale . y , serverTime ) ;
561
560
m_ScaleZInterpolator . ResetTo ( transform . localScale . z , serverTime ) ;
@@ -938,26 +937,6 @@ private void AddInterpolatedState(NetworkTransformState newState)
938
937
}
939
938
}
940
939
941
- /// <summary>
942
- /// Stops extrapolating the <see cref="m_LastReceivedState"/>.
943
- /// </summary>
944
- /// <remarks>
945
- /// <see cref="OnNetworkStateChanged"/>
946
- /// </remarks>
947
- private void TryToStopExtrapolatingLastState ( )
948
- {
949
- if ( ! m_LastReceivedState . IsDirty || m_LastReceivedState . EndExtrapolationTick >= NetworkManager . LocalTime . Tick )
950
- {
951
- return ;
952
- }
953
- // Offset by 1 tick duration
954
- m_LastReceivedState . SentTime += m_TickFrequency ;
955
- AddInterpolatedState ( m_LastReceivedState ) ;
956
-
957
- // Now reset our last received state so we won't apply this state again
958
- m_LastReceivedState . ClearBitSetForNextTick ( ) ;
959
- }
960
-
961
940
/// <summary>
962
941
/// Only non-authoritative instances should invoke this method
963
942
/// </summary>
@@ -976,21 +955,8 @@ private void OnNetworkStateChanged(NetworkTransformState oldState, NetworkTransf
976
955
977
956
if ( Interpolate )
978
957
{
979
- // This is "just in case" we receive a new state before the end
980
- // of any currently applied and potentially extrapolating state.
981
- // Attempts to stop extrapolating any previously applied state.
982
- TryToStopExtrapolatingLastState ( ) ;
983
-
984
958
// Add measurements for the new state's deltas
985
959
AddInterpolatedState ( newState ) ;
986
-
987
- // Set the last received state to the new state (will be used to stop extrapolating the new state on the next local tick)
988
- m_LastReceivedState = newState ;
989
-
990
- // Set the current local tick and wait until the next tick before we end
991
- // this state's potential of extrapolating past the target value beyond
992
- // the state's relative tick duration
993
- m_LastReceivedState . EndExtrapolationTick = NetworkManager . LocalTime . Tick ;
994
960
}
995
961
}
996
962
@@ -1115,6 +1081,11 @@ private void Initialize()
1115
1081
// In case we are late joining
1116
1082
ResetInterpolatedStateToCurrentAuthoritativeState ( ) ;
1117
1083
}
1084
+
1085
+ if ( ! IsServer )
1086
+ {
1087
+ Interpolate = false ;
1088
+ }
1118
1089
}
1119
1090
1120
1091
/// <summary>
@@ -1261,6 +1232,10 @@ protected virtual void Update()
1261
1232
{
1262
1233
return ;
1263
1234
}
1235
+ if ( ! IsServer )
1236
+ {
1237
+ Interpolate = false ;
1238
+ }
1264
1239
1265
1240
// If we are authority, update the authoritative state
1266
1241
if ( CanCommitToTransform )
@@ -1285,9 +1260,6 @@ protected virtual void Update()
1285
1260
1286
1261
// Apply the current authoritative state
1287
1262
ApplyAuthoritativeState ( ) ;
1288
-
1289
- // Attempts to stop extrapolating any previously applied state.
1290
- TryToStopExtrapolatingLastState ( ) ;
1291
1263
}
1292
1264
}
1293
1265
0 commit comments