You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Constant absolute value for max buffer count instead of dynamic time based value. This is in case we have very low tick rates, so
15
+
// that we don't have a very small buffer because of this.
16
+
privateconstintk_BufferCountLimit=100;
14
17
privateconstfloatk_AproximatePrecision=0.0001f;
18
+
privateconstdoublek_SmallValue=9.999999439624929E-11;// copied from Vector3's equal operator
19
+
20
+
#region Legacy notes
21
+
// Buffer consumption scenarios
22
+
// Perfect case consumption
23
+
// | 1 | 2 | 3 |
24
+
// | 2 | 3 | 4 | consume 1
25
+
// | 3 | 4 | 5 | consume 2
26
+
// | 4 | 5 | 6 | consume 3
27
+
// | 5 | 6 | 7 | consume 4
28
+
// jittered case
29
+
// | 1 | 2 | 3 |
30
+
// | 2 | 3 | | consume 1
31
+
// | 3 | | | consume 2
32
+
// | 4 | 5 | 6 | consume 3
33
+
// | 5 | 6 | 7 | consume 4
34
+
// bursted case (assuming max count is 5)
35
+
// | 1 | 2 | 3 |
36
+
// | 2 | 3 | | consume 1
37
+
// | 3 | | | consume 2
38
+
// | | | | consume 3
39
+
// | | | |
40
+
// | 4 | 5 | 6 | 7 | 8 | --> consume all and teleport to last value <8> --> this is the nuclear option, ideally this example would consume 4 and 5
41
+
// instead of jumping to 8, but since in OnValueChange we don't yet have an updated server time (updated in pre-update) to know which value
42
+
// we should keep and which we should drop, we don't have enough information to do this. Another thing would be to not have the burst in the first place.
43
+
#endregion
44
+
45
+
#region Properties being deprecated
46
+
/// <summary>
47
+
/// The legacy list of <see cref="BufferedItem"/> items.
48
+
/// </summary>
49
+
/// <remarks>
50
+
/// This is replaced by the <see cref="m_BufferQueue"/> of type <see cref="Queue{T}"/>.
51
+
/// </remarks>
52
+
[Obsolete("This list is no longer used and will be deprecated.",false)]
/// The starting value of type <see cref="T"/> to interpolate from.
58
+
/// </summary>
59
+
[Obsolete("This property will be deprecated.",false)]
60
+
protectedinternalTm_InterpStartValue;
61
+
62
+
/// <summary>
63
+
/// ** Deprecating **
64
+
/// The current value of type <see cref="T"/>.
65
+
/// </summary>
66
+
[Obsolete("This property will be deprecated.",false)]
67
+
protectedinternalTm_CurrentInterpValue;
68
+
69
+
/// <summary>
70
+
/// ** Deprecating **
71
+
/// The end (or target) value of type <see cref="T"/> to interpolate towards.
72
+
/// </summary>
73
+
[Obsolete("This property will be deprecated.",false)]
74
+
protectedinternalTm_InterpEndValue;
75
+
#endregion
15
76
16
77
/// <summary>
17
78
/// Represents a buffered item measurement.
@@ -44,6 +105,13 @@ public BufferedItem(T item, double timeSent, int itemId)
44
105
ItemId=itemId;
45
106
}
46
107
}
108
+
109
+
/// <summary>
110
+
/// The current internal state of the <see cref="BufferedLinearInterpolator{T}"/>.
111
+
/// </summary>
112
+
/// <remarks>
113
+
/// Not public API ready yet.
114
+
/// </remarks>
47
115
internalstructCurrentState
48
116
{
49
117
publicBufferedItem?Target;
@@ -105,35 +173,6 @@ public void Reset(T currentValue)
105
173
}
106
174
}
107
175
108
-
// Buffer consumption scenarios
109
-
// Perfect case consumption
110
-
// | 1 | 2 | 3 |
111
-
// | 2 | 3 | 4 | consume 1
112
-
// | 3 | 4 | 5 | consume 2
113
-
// | 4 | 5 | 6 | consume 3
114
-
// | 5 | 6 | 7 | consume 4
115
-
// jittered case
116
-
// | 1 | 2 | 3 |
117
-
// | 2 | 3 | | consume 1
118
-
// | 3 | | | consume 2
119
-
// | 4 | 5 | 6 | consume 3
120
-
// | 5 | 6 | 7 | consume 4
121
-
// bursted case (assuming max count is 5)
122
-
// | 1 | 2 | 3 |
123
-
// | 2 | 3 | | consume 1
124
-
// | 3 | | | consume 2
125
-
// | | | | consume 3
126
-
// | | | |
127
-
// | 4 | 5 | 6 | 7 | 8 | --> consume all and teleport to last value <8> --> this is the nuclear option, ideally this example would consume 4 and 5
128
-
// instead of jumping to 8, but since in OnValueChange we don't yet have an updated server time (updated in pre-update) to know which value
129
-
// we should keep and which we should drop, we don't have enough information to do this. Another thing would be to not have the burst in the first place.
130
-
131
-
// Constant absolute value for max buffer count instead of dynamic time based value. This is in case we have very low tick rates, so
132
-
// that we don't have a very small buffer because of this.
133
-
privateconstintk_BufferCountLimit=100;
134
-
135
-
privateconstdoublek_SmallValue=9.999999439624929E-11;// copied from Vector3's equal operator
136
-
137
176
/// <summary>
138
177
/// Determines how much smoothing will be applied to the 2nd lerp when using the <see cref="Update(float, double, double)"/> (i.e. lerping and not smooth dampening).
139
178
/// </summary>
@@ -145,61 +184,27 @@ public void Reset(T currentValue)
145
184
[Range(0.016f,1.0f)]
146
185
publicfloatMaximumInterpolationTime=0.1f;
147
186
148
-
/// <summary>
149
-
/// The maximum Lerp "t" boundary when using standard lerping for interpolation
150
-
/// </summary>
151
-
internalfloatMaxInterpolationBound=3.0f;
152
-
153
-
privateintm_BufferCount;
154
-
155
-
privateBufferedItemm_LastBufferedItemReceived;
156
-
privateintm_NbItemsReceivedThisFrame;
157
-
158
-
privatedoublem_LastMeasurementAddedTime=0.0f;
159
-
internalboolEndOfBuffer=>m_BufferQueue.Count==0;
160
-
161
-
internalboolInLocalSpace;
162
-
163
-
/// <summary>
164
-
/// The current interpolation state
165
-
/// </summary>
166
-
internalCurrentStateInterpolateState;
167
-
168
187
/// <summary>
169
188
/// The current buffered items received by the authority.
/// The starting value of type <see cref="T"/> to interpolate from.
185
-
/// </summary>
186
-
[Obsolete("This property will be deprecated.",false)]
187
-
protectedinternalTm_InterpStartValue;
188
-
189
-
/// <summary>
190
-
/// ** Deprecating **
191
-
/// The current value of type <see cref="T"/>.
193
+
/// The current interpolation state
192
194
/// </summary>
193
-
[Obsolete("This property will be deprecated.",false)]
194
-
protectedinternalTm_CurrentInterpValue;
195
+
internalCurrentStateInterpolateState;
195
196
196
197
/// <summary>
197
-
/// ** Deprecating **
198
-
/// The end (or target) value of type <see cref="T"/> to interpolate towards.
198
+
/// The maximum Lerp "t" boundary when using standard lerping for interpolation
199
199
/// </summary>
200
-
[Obsolete("This property will be deprecated.",false)]
201
-
protectedinternalTm_InterpEndValue;
200
+
internalfloatMaxInterpolationBound=3.0f;
201
+
internalboolEndOfBuffer=>m_BufferQueue.Count==0;
202
+
internalboolInLocalSpace;
202
203
204
+
privatedoublem_LastMeasurementAddedTime=0.0f;
205
+
privateintm_BufferCount;
206
+
privateintm_NbItemsReceivedThisFrame;
207
+
privateBufferedItemm_LastBufferedItemReceived;
203
208
/// <summary>
204
209
/// Represents the rate of change for the value being interpolated when smooth dampening is enabled.
205
210
/// </summary>
@@ -210,12 +215,10 @@ public void Reset(T currentValue)
210
215
/// </summary>
211
216
privateTm_PredictedRateOfChange;
212
217
213
-
privateboolm_IsAngularValue;
214
-
215
218
/// <summary>
216
219
/// When true, the value <see cref="T"/> is an angular numeric representation.
217
220
/// </summary>
218
-
protectedboolIsAngularValue=>m_IsAngularValue;
221
+
privateprotectedboolm_IsAngularValue;
219
222
220
223
/// <summary>
221
224
/// Resets interpolator to the defaults.
@@ -237,10 +240,12 @@ public void Clear()
237
240
/// This is used when first synchronizing/initializing and when telporting an object.
238
241
/// </remarks>
239
242
/// <param name="targetValue">The target value to reset the interpolator to</param>
240
-
/// <param name="serverTime">The current server time</param>
243
+
/// <param name="serverTime">The current server time</param>
241
244
/// <param name="isAngularValue">When rotation is expressed as Euler values (i.e. Vector3 and/or float) this helps determine what kind of smooth dampening to use.</param>
0 commit comments