Skip to content

Commit 112b302

Browse files
docs: condense the ResetTo baseline measurement comment
The why sat in a sixteen line block inside the internal overload's body, while NativeInterpolator.ResetTo pointed at the public overload's remarks for it. Moved it to where that reference already aims and left a one line marker on the call. Dropped the proof that the resulting state is safe and the ownership transition scenario. Both are readable from Clear and InternalReset, or belong in the PR.
1 parent 4e5837f commit 112b302

1 file changed

Lines changed: 6 additions & 16 deletions

File tree

com.unity.netcode.gameobjects/Runtime/Components/Interpolator/BufferedLinearInterpolator.cs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,11 @@ public void Clear()
275275
/// </summary>
276276
/// <remarks>
277277
/// This is used when first synchronizing/initializing and when teleporting an object.<br />
278+
/// No baseline measurement is recorded.<br />
279+
/// A baseline is stamped with the local ServerTime.Time.<br />
280+
/// The measurements that follow carry the older tick they were authored on.<br />
281+
/// AddMeasurement would drop every one of those.<br />
282+
/// The interpolator is left the way a freshly spawned one is instead.<br />
278283
/// <paramref name="serverTime"/> is not used. Mark this obsolete and deprecate it at a later date.
279284
/// </remarks>
280285
/// <param name="targetValue">The target value to reset the interpolator to</param>
@@ -289,22 +294,7 @@ internal void ResetTo(Transform parent, T targetValue, double serverTime)
289294
// Clear the interpolator
290295
Clear();
291296

292-
// The baseline measurement is deliberately not seeded here. Callers stamp it with
293-
// NetworkManager.ServerTime.Time (the local current time) while the measurements that follow are
294-
// stamped with the tick they were authored on (NetworkTransformState.SentTime), which is always at
295-
// least a tick older. Seeding the baseline therefore establishes an ordering floor that later
296-
// measurements cannot clear: AddMeasurement drops anything not newer than m_LastMeasurementAddedTime,
297-
// and TryConsumeFromBuffer drops anything not newer than InterpolateState.Target.TimeSent.
298-
//
299-
// This only reaches an instance that resets part way through a session, which in practice means one
300-
// that just stopped being the authority (in a client server topology, only ever the server). Such an
301-
// instance would otherwise reject everything the new authority sends until a measurement happens to
302-
// be authored on a later tick than the reset, and if motion has already stopped that never arrives.
303-
//
304-
// Clear() has left the buffer empty with a zeroed m_LastMeasurementAddedTime, and InternalReset seeds
305-
// CurrentValue/NextValue/PreviousValue below, so the value is still held. That is exactly the state a
306-
// freshly spawned interpolator is in: the first measurement to arrive is taken unconditionally
307-
// because m_BufferCount is zero, and it is consumed against render time alone.
297+
// No baseline measurement. See the ResetTo remarks above.
308298
InternalReset(parent, targetValue, serverTime, false);
309299
}
310300

0 commit comments

Comments
 (0)