Skip to content

Commit 283ab9f

Browse files
fix
More PVP fun
1 parent 15c8e59 commit 283ab9f

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ public abstract class BufferedLinearInterpolator<T> where T : struct
1313
{
1414
private const float k_AproximatePrecision = 0.0001f;
1515

16+
/// <summary>
17+
/// Represents a buffered item measurement.
18+
/// </summary>
1619
protected internal struct BufferedItem
1720
{
1821
public int ItemId;
@@ -117,7 +120,6 @@ public void Reset(T currentValue)
117120
private BufferedItem m_LastBufferedItemReceived;
118121
private int m_NbItemsReceivedThisFrame;
119122

120-
protected internal T m_CurrentInterpValue;
121123
private double m_LastMeasurementAddedTime = 0.0f;
122124
internal bool EndOfBuffer => m_Buffer.Count == 0;
123125

@@ -127,17 +129,22 @@ public void Reset(T currentValue)
127129
/// The current interpolation state
128130
/// </summary>
129131
internal CurrentState InterpolateState;
132+
133+
/// <summary>
134+
/// The current buffered items received by the authority.
135+
/// </summary>
130136
protected internal readonly Queue<BufferedItem> m_Buffer = new Queue<BufferedItem>(k_BufferCountLimit);
131137

132138
/// <summary>
133139
/// Represents the rate of change for the value being interpolated when smooth dampening is enabled.
134140
/// </summary>
135141
private T m_RateOfChange;
136142

137-
private bool m_UseSmoothDamening;
138-
protected bool UseSmoothDampening => m_UseSmoothDamening;
139-
140143
private bool m_IsAngularValue;
144+
145+
/// <summary>
146+
/// When true, the value <see cref="T"/> is an angular numeric representation.
147+
/// </summary>
141148
protected bool IsAngularValue => m_IsAngularValue;
142149

143150
/// <summary>
@@ -147,7 +154,6 @@ public void Clear()
147154
{
148155
m_Buffer.Clear();
149156
m_BufferCount = 0;
150-
m_CurrentInterpValue = default;
151157
m_LastMeasurementAddedTime = 0.0;
152158
InterpolateState.Reset(default);
153159
m_RateOfChange = default;
@@ -171,8 +177,6 @@ public void ResetTo(T targetValue, double serverTime, bool isAngularValue = fals
171177
Clear();
172178
// Set our initial value
173179
InterpolateState.Reset(targetValue);
174-
// TODO: If we get single lerping working, then m_CurrentInterpValue is no longer needed.
175-
m_CurrentInterpValue = targetValue;
176180
m_IsAngularValue = isAngularValue;
177181

178182
// Add the first measurement for our baseline
@@ -416,8 +420,10 @@ protected internal virtual bool IsAproximately(T first, T second, float precisio
416420
/// <summary>
417421
/// Converts a value of type <see cref="T"/> from world to local space or vice versa.
418422
/// </summary>
419-
/// <param name="transform">Reference transform</param>
420-
/// <param name="inLocalSpace">local or world space (true or false)</param>
423+
/// <param name="transform">Reference transform.</param>
424+
/// <param name="item">The item to convert.</param>
425+
/// <param name="inLocalSpace">local or world space (true or false).</param>
426+
/// <returns>The converted value.</returns>
421427
protected internal virtual T OnConvertTransformSpace(Transform transform, T item, bool inLocalSpace)
422428
{
423429
return default;

0 commit comments

Comments
 (0)