@@ -448,29 +448,39 @@ public GhostCommit updateGhostPlayer(uint ID, NearbyInfoResponse response, Ghost
448
448
double progress = ( ( ghostPlane . Progress + deltaTime ) - prev . Timer ) / ( curr . Timer - prev . Timer ) ;
449
449
double timeLeft = curr . Timer - ( ghostPlane . Progress + deltaTime ) ;
450
450
451
- double distancePrev = _mathClass . findDistanceBetweenPoints ( response . Latitude , response . Longitude , prev . Location . Latitude , prev . Location . Longitude ) ;
451
+ // double distancePrev = _mathClass.findDistanceBetweenPoints(response.Latitude, response.Longitude, prev.Location.Latitude, prev.Location.Longitude);
452
452
double distanceCurr = _mathClass . findDistanceBetweenPoints ( response . Latitude , response . Longitude , curr . Location . Latitude , curr . Location . Longitude ) ;
453
- double distanceNext = _mathClass . findDistanceBetweenPoints ( response . Latitude , response . Longitude , next . Location . Latitude , next . Location . Longitude ) ;
453
+ //double distanceNext = _mathClass.findDistanceBetweenPoints(response.Latitude, response.Longitude, next.Location.Latitude, next.Location.Longitude);
454
+
455
+ /*if (distanceCurr / timeLeft > 1.25 * curr.Velocity)
456
+ {
457
+ distanceCurr = 1.25 * curr.Velocity * timeLeft;
458
+ Console.WriteLine($"TOO FAR FROM NEXT POINT: {distanceCurr:F6}");
459
+ }*/
460
+
454
461
455
462
double bearing = normalizeRadAngle ( _mathClass . findBearingToPoint ( response . Latitude , response . Longitude , next . Location . Latitude , next . Location . Longitude ) ) ;
456
463
response . Heading = normalizeRadAngle ( response . Heading ) ;
457
464
bearing = zeroeRadAngle ( bearing - response . Heading ) ;
458
465
double newHeading = zeroeRadAngle ( response . Heading + ( absoluteTime - ghostPlane . LastTrackPlayed ) * bearing ) ;
459
- towCommit . RotationVelocityBodyY = Math . Sin ( newHeading - response . Heading ) ;
466
+ //towCommit.RotationVelocityBodyY = Math.Sin(newHeading - response.Heading);
467
+ towCommit . planeHeading = newHeading ;
460
468
//Console.WriteLine($"Tracking heading: {response.Heading:F4} bearing: {bearing:F4} newHeading: {newHeading:F4}");
461
469
462
470
double requiredBank = ( ( 1 - progress ) * ( prev . Roll * Math . PI / 180 - response . Bank ) + progress * ( curr . Roll * Math . PI / 180 - response . Bank ) ) / 2 ;
463
- towCommit . RotationVelocityBodyZ = Math . Sin ( requiredBank - response . Bank ) ;
471
+ //towCommit.RotationVelocityBodyZ = Math.Sin(requiredBank - response.Bank);
472
+ towCommit . planeRoll = requiredBank ;
464
473
double requiredPitch = ( ( 1 - progress ) * ( prev . Pitch * Math . PI / 180 - response . Pitch ) + progress * ( prev . Pitch * Math . PI / 180 - response . Pitch ) ) / 2 ;
465
- towCommit . RotationVelocityBodyX = Math . Sin ( requiredPitch - response . Pitch ) ;
474
+ //towCommit.RotationVelocityBodyX = Math.Sin(requiredPitch - response.Pitch);
475
+ towCommit . planePitch = requiredPitch ;
466
476
467
477
//Console.WriteLine($"RotationVelocityBodyX: {towCommit.RotationVelocityBodyX:F4} RotationVelocityBodyY: {towCommit.RotationVelocityBodyY:F4} RotationVelocityBodyZ: {towCommit.RotationVelocityBodyZ:F4}");
468
478
//towCommit.Heading = newHeading;
469
479
470
480
towCommit . VelocityBodyX = 0 ;
471
481
towCommit . VelocityBodyY = ( ( 1 - progress ) * ( prev . Elevation - response . Altitude ) + progress * ( curr . Elevation - response . Altitude ) ) / 2 ;
472
- towCommit . VelocityBodyZ = ( 0.8 * curr . Velocity + 0.1 * distanceCurr / Math . Max ( 1 , timeLeft ) ) * ( Math . Abs ( distanceCurr ) < 10 ? Math . Abs ( distanceCurr ) / 10 : 1 ) ;
473
-
482
+ towCommit . VelocityBodyZ = ( 0.9 * curr . Velocity + 0.1 * distanceCurr / Math . Max ( 1 , timeLeft ) ) * ( distanceCurr < 10 ? distanceCurr / 10 : 1 ) ;
483
+
474
484
// TAXIING
475
485
if ( towCommit . VelocityBodyZ < 1 && towCommit . VelocityBodyZ > - 1 )
476
486
{
@@ -524,6 +534,10 @@ public GhostCommit updateGhostPlayer(uint ID, NearbyInfoResponse response, Ghost
524
534
525
535
ghostPlanes [ index ] = gp ;
526
536
}
537
+ else
538
+ {
539
+
540
+ }
527
541
528
542
529
543
return towCommit ;
0 commit comments