Skip to content

Commit d264c0e

Browse files
update
Added comments and renamed a property.
1 parent 6de8b39 commit d264c0e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

com.unity.netcode.gameobjects/Components/NetworkTransform.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ internal bool IsTeleportingNextFrame
212212
internal bool IsDirty;
213213

214214
// Non-Authoritative side uses this for ending extrapolation of the last applied state
215-
internal int ExtrapolateTick;
215+
internal int EndExtrapolationTick;
216216

217217
/// <summary>
218218
/// This will reset the NetworkTransform BitSet
@@ -933,10 +933,11 @@ private void AddInterpolatedState(NetworkTransformState newState)
933933
/// </remarks>
934934
private void StopExtrapolatingLastState()
935935
{
936-
if (!m_LastReceivedState.IsDirty || m_LastReceivedState.ExtrapolateTick >= NetworkManager.LocalTime.Tick)
936+
if (!m_LastReceivedState.IsDirty || m_LastReceivedState.EndExtrapolationTick >= NetworkManager.LocalTime.Tick)
937937
{
938938
return;
939939
}
940+
// Offset by 1 tick duration
940941
m_LastReceivedState.SentTime += m_TickFrequency;
941942
AddInterpolatedState(m_LastReceivedState);
942943
m_LastReceivedState.ClearBitSetForNextTick();
@@ -965,7 +966,9 @@ private void OnNetworkStateChanged(NetworkTransformState oldState, NetworkTransf
965966
StopExtrapolatingLastState();
966967
AddInterpolatedState(newState);
967968
m_LastReceivedState = newState;
968-
m_LastReceivedState.ExtrapolateTick = NetworkManager.LocalTime.Tick;
969+
// Set the current local tick and wait until the next tick before we end
970+
// this state's extrapolation.
971+
m_LastReceivedState.EndExtrapolationTick = NetworkManager.LocalTime.Tick;
969972
}
970973
}
971974

0 commit comments

Comments
 (0)