@@ -18,17 +18,18 @@ internal void ReverseTransform(float secondsAgo)
18
18
savedPosition = transform . position ;
19
19
savedRotation = transform . rotation ;
20
20
float currentTime = Time . time ;
21
- float targetTime = Time . time - secondsAgo ;
21
+ float targetTime = currentTime - secondsAgo ;
22
22
float previousTime = 0 ;
23
23
float nextTime = 0 ;
24
- for ( int i = 1 ; i < Framekeys . Count - 1 ; i ++ )
24
+ for ( int i = 1 ; i < Framekeys . Count ; i ++ )
25
25
{
26
- if ( Framekeys [ i - 1 ] > targetTime && Framekeys [ i ] < = targetTime )
26
+ if ( Framekeys [ i - 1 ] <= targetTime && Framekeys [ i ] > = targetTime )
27
27
{
28
28
previousTime = Framekeys [ i ] ;
29
29
nextTime = Framekeys [ i + 1 ] ;
30
30
break ;
31
31
}
32
+
32
33
}
33
34
34
35
float timeBetweenFrames = nextTime - previousTime ;
@@ -59,7 +60,7 @@ internal void AddFrame()
59
60
float currentTime = Time . time ;
60
61
for ( int i = 0 ; i < Framekeys . Count ; i ++ )
61
62
{
62
- if ( currentTime - Framekeys [ i ] < = NetworkingManager . singleton . NetworkConfig . SecondsHistory )
63
+ if ( currentTime - Framekeys [ i ] > = NetworkingManager . singleton . NetworkConfig . SecondsHistory )
63
64
{
64
65
for ( int j = 0 ; j < i ; j ++ )
65
66
{
@@ -74,7 +75,7 @@ internal void AddFrame()
74
75
position = transform . position ,
75
76
rotation = transform . rotation
76
77
} ) ;
77
- Framekeys . Add ( Time . frameCount ) ;
78
+ Framekeys . Add ( Time . time ) ;
78
79
}
79
80
}
80
81
}
0 commit comments