File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
MLAPI/MonoBehaviours/Core Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,29 @@ public class TrackedObject : MonoBehaviour
19
19
private Vector3 savedPosition ;
20
20
private Quaternion savedRotation ;
21
21
22
+ /// <summary>
23
+ /// Gets the total amount of points stored in the component
24
+ /// </summary>
25
+ public int TotalPoints
26
+ {
27
+ get
28
+ {
29
+ return Framekeys . Count ;
30
+ }
31
+ }
32
+
33
+ /// <summary>
34
+ /// Gets the average amount of time between the points in miliseconds
35
+ /// </summary>
36
+ public float AvgTimeBetweenPointsMs
37
+ {
38
+ get
39
+ {
40
+ float totalSpan = Framekeys . Last . Value - Framekeys . First . Value ;
41
+ return ( totalSpan / Framekeys . Count ) * 1000f ;
42
+ }
43
+ }
44
+
22
45
internal void ReverseTransform ( float secondsAgo )
23
46
{
24
47
savedPosition = transform . position ;
@@ -75,7 +98,7 @@ internal void AddFrame()
75
98
float currentTime = Time . time ;
76
99
LinkedListNode < float > node = Framekeys . First ;
77
100
LinkedListNode < float > nextNode = node . Next ;
78
- while ( currentTime - node . Value >= NetworkingManager . singleton . NetworkConfig . SecondsHistory )
101
+ while ( node != null && currentTime - node . Value >= NetworkingManager . singleton . NetworkConfig . SecondsHistory )
79
102
{
80
103
nextNode = node . Next ;
81
104
FrameData . Remove ( node . Value ) ;
You can’t perform that action at this time.
0 commit comments