@@ -21,8 +21,8 @@ public static class BasisRemoteNetworkDriver
2121 static NativeArray < quaternion > _prevRotations ;
2222 static NativeArray < quaternion > _targetRotations ;
2323
24- static NativeArray < float > _interpolationTimes ; // 0..1
25- static NativeArray < float > _deltaTimes ; // NEW: seconds (real dt for filters)
24+ static NativeArray < double > _interpolationTimes ; // 0..1
25+ static NativeArray < double > _deltaTimes ; // NEW: seconds (real dt for filters)
2626
2727 static NativeArray < float3 > _outPositions ;
2828 static NativeArray < float3 > _outScales ;
@@ -116,9 +116,9 @@ public static void Shutdown()
116116 /// Write timing inputs for a given index (0..FixedCapacity-1).
117117 /// interpolationTime is 0..1 blend factor, deltaTimeSeconds is REAL seconds-per-frame for filters.
118118 /// </summary>
119- public static void SetFrameTiming ( int index , float interpolationTime , float deltaTimeSeconds )
119+ public static void SetFrameTiming ( int index , double interpolationTime , double deltaTimeSeconds )
120120 {
121- _interpolationTimes [ index ] = interpolationTime ;
121+ _interpolationTimes [ index ] = ( float ) interpolationTime ;
122122 _deltaTimes [ index ] = deltaTimeSeconds ;
123123 }
124124
@@ -258,8 +258,8 @@ static void AllocateAll(int capacity)
258258 _prevRotations = new NativeArray < quaternion > ( capacity , _allocator , NativeArrayOptions . UninitializedMemory ) ;
259259 _targetRotations = new NativeArray < quaternion > ( capacity , _allocator , NativeArrayOptions . UninitializedMemory ) ;
260260
261- _interpolationTimes = new NativeArray < float > ( capacity , _allocator , NativeArrayOptions . ClearMemory ) ;
262- _deltaTimes = new NativeArray < float > ( capacity , _allocator , NativeArrayOptions . UninitializedMemory ) ; // NEW
261+ _interpolationTimes = new NativeArray < double > ( capacity , _allocator , NativeArrayOptions . ClearMemory ) ;
262+ _deltaTimes = new NativeArray < double > ( capacity , _allocator , NativeArrayOptions . UninitializedMemory ) ; // NEW
263263
264264 _outPositions = new NativeArray < float3 > ( capacity , _allocator , NativeArrayOptions . UninitializedMemory ) ;
265265 _outScales = new NativeArray < float3 > ( capacity , _allocator , NativeArrayOptions . UninitializedMemory ) ;
@@ -328,7 +328,7 @@ public struct BasisOneEuroFilterParallelJob : IJobParallelFor
328328 [ WriteOnly ] public NativeArray < float > OutputValues ;
329329
330330 // NEW: per-player real dt seconds (length == numPlayers)
331- [ ReadOnly ] public NativeArray < float > DeltaTimeSeconds ;
331+ [ ReadOnly ] public NativeArray < double > DeltaTimeSeconds ;
332332
333333 public NativeArray < float2 > PositionFilters ; // x = previous input, y = previous output
334334 public NativeArray < float2 > DerivativeFilters ; // x = previous derivative input, y = previous derivative output
@@ -343,35 +343,35 @@ public void Execute(int index)
343343 {
344344 int playerIndex = MuscleCountPerAvatar > 0 ? ( index / MuscleCountPerAvatar ) : 0 ;
345345
346- float dt = math . max ( DeltaTimeSeconds [ playerIndex ] , 1e-3f ) ;
347- float frequency = math . rcp ( dt ) ;
346+ double dt = math . max ( DeltaTimeSeconds [ playerIndex ] , 1e-3f ) ;
347+ double frequency = math . rcp ( dt ) ;
348348
349349 float inputValue = InputValues [ index ] ;
350350
351351 float prevFiltered = PositionFilters [ index ] . y ;
352352 float prevRaw = PositionFilters [ index ] . x ;
353353
354- float dValue = ( inputValue - prevRaw ) * frequency ;
354+ double dValue = ( ( inputValue - prevRaw ) * frequency ) ;
355355
356- float alphaD = Alpha ( DerivativeCutoff , frequency ) ;
356+ double alphaD = Alpha ( DerivativeCutoff , frequency ) ;
357357 float prevDerivFiltered = DerivativeFilters [ index ] . y ;
358- float edValue = alphaD * dValue + ( 1f - alphaD ) * prevDerivFiltered ;
358+ double edValue = alphaD * dValue + ( 1f - alphaD ) * prevDerivFiltered ;
359359
360- float cutoff = MinCutoff + Beta * math . abs ( edValue ) ;
361- float alphaX = Alpha ( cutoff , frequency ) ;
360+ double cutoff = MinCutoff + Beta * math . abs ( edValue ) ;
361+ double alphaX = Alpha ( cutoff , frequency ) ;
362362
363- float filtered = alphaX * inputValue + ( 1f - alphaX ) * prevFiltered ;
363+ double filtered = alphaX * inputValue + ( 1f - alphaX ) * prevFiltered ;
364364
365- OutputValues [ index ] = filtered ;
366- PositionFilters [ index ] = new float2 ( inputValue , filtered ) ;
367- DerivativeFilters [ index ] = new float2 ( dValue , edValue ) ;
365+ OutputValues [ index ] = ( float ) filtered ;
366+ PositionFilters [ index ] = new float2 ( inputValue , ( float ) filtered ) ;
367+ DerivativeFilters [ index ] = new float2 ( ( float ) dValue , ( float ) edValue ) ;
368368 }
369369
370370 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
371- private static float Alpha ( float cutoff , float frequency )
371+ private static double Alpha ( double cutoff , double frequency )
372372 {
373- float te = math . rcp ( frequency ) ;
374- float tau = math . rcp ( 2f * math . PI * math . max ( cutoff , 1e-4f ) ) ;
373+ double te = math . rcp ( frequency ) ;
374+ double tau = math . rcp ( 2f * math . PI * math . max ( cutoff , 1e-4f ) ) ;
375375 return math . rcp ( 1f + tau / te ) ;
376376 }
377377 }
@@ -388,7 +388,7 @@ public struct UpdateAllAvatarsJob : IJobParallelFor
388388 [ ReadOnly ] public NativeArray < quaternion > PreviousRotations ;
389389 [ ReadOnly ] public NativeArray < quaternion > TargetRotations ;
390390
391- [ ReadOnly ] public NativeArray < float > InterpolationTimes ;
391+ [ ReadOnly ] public NativeArray < double > InterpolationTimes ;
392392
393393 [ WriteOnly ] public NativeArray < float3 > OutputPositions ;
394394 [ WriteOnly ] public NativeArray < float3 > OutputScales ;
@@ -398,7 +398,7 @@ public struct UpdateAllAvatarsJob : IJobParallelFor
398398
399399 public void Execute ( int index )
400400 {
401- float t = InterpolationTimes [ index ] ;
401+ float t = ( float ) InterpolationTimes [ index ] ;
402402 if ( ! math . isfinite ( t ) )
403403 {
404404 t = 0f ;
@@ -424,7 +424,7 @@ public struct UpdateAllAvatarMusclesJob : IJobParallelFor
424424 {
425425 [ ReadOnly ] public NativeArray < float > PreviousMuscles ;
426426 [ ReadOnly ] public NativeArray < float > TargetMuscles ;
427- [ ReadOnly ] public NativeArray < float > InterpolationTimes ;
427+ [ ReadOnly ] public NativeArray < double > InterpolationTimes ;
428428
429429 [ WriteOnly ] public NativeArray < float > OutputMuscles ;
430430
@@ -433,9 +433,9 @@ public struct UpdateAllAvatarMusclesJob : IJobParallelFor
433433 public void Execute ( int index )
434434 {
435435 int playerIndex = index / MuscleCountPerAvatar ;
436- float t = InterpolationTimes [ playerIndex ] ;
436+ double t = InterpolationTimes [ playerIndex ] ;
437437 t = math . clamp ( t , 0f , 1f ) ;
438- OutputMuscles [ index ] = math . lerp ( PreviousMuscles [ index ] , TargetMuscles [ index ] , t ) ;
438+ OutputMuscles [ index ] = ( float ) math . lerp ( PreviousMuscles [ index ] , TargetMuscles [ index ] , t ) ;
439439 }
440440 }
441441
0 commit comments