@@ -18,17 +18,18 @@ internal void ReverseTransform(float secondsAgo)
1818 savedPosition = transform . position ;
1919 savedRotation = transform . rotation ;
2020 float currentTime = Time . time ;
21- float targetTime = Time . time - secondsAgo ;
21+ float targetTime = currentTime - secondsAgo ;
2222 float previousTime = 0 ;
2323 float nextTime = 0 ;
24- for ( int i = 1 ; i < Framekeys . Count - 1 ; i ++ )
24+ for ( int i = 1 ; i < Framekeys . Count ; i ++ )
2525 {
26- if ( Framekeys [ i - 1 ] > targetTime && Framekeys [ i ] < = targetTime )
26+ if ( Framekeys [ i - 1 ] <= targetTime && Framekeys [ i ] > = targetTime )
2727 {
2828 previousTime = Framekeys [ i ] ;
2929 nextTime = Framekeys [ i + 1 ] ;
3030 break ;
3131 }
32+
3233 }
3334
3435 float timeBetweenFrames = nextTime - previousTime ;
@@ -59,7 +60,7 @@ internal void AddFrame()
5960 float currentTime = Time . time ;
6061 for ( int i = 0 ; i < Framekeys . Count ; i ++ )
6162 {
62- if ( currentTime - Framekeys [ i ] < = NetworkingManager . singleton . NetworkConfig . SecondsHistory )
63+ if ( currentTime - Framekeys [ i ] > = NetworkingManager . singleton . NetworkConfig . SecondsHistory )
6364 {
6465 for ( int j = 0 ; j < i ; j ++ )
6566 {
@@ -74,7 +75,7 @@ internal void AddFrame()
7475 position = transform . position ,
7576 rotation = transform . rotation
7677 } ) ;
77- Framekeys . Add ( Time . frameCount ) ;
78+ Framekeys . Add ( Time . time ) ;
7879 }
7980 }
8081}
0 commit comments