public override Quaternion CalculateWorldRotation()
 {
     if (Time.time - startTime >= GlobalManager.timeToCorrectPose)
     {
         return(orientation);
     }
     else
     {
         return(correctPoseManeuver.CalculateWorldRotation());
     }
 }
示例#2
0
 public override Quaternion CalculateWorldRotation()
 {
     //Calculate the "forward" direction by taking the derivative of the position with respect to time, removing factors shared
     //by all components of the vector like r and omega
     //The minus sign in front of the vector is because our Hercules model's "forward" direction is in the direction of the tail
     //I don't know why the "upward" direction is AWAY from the center of the circle instead of TOWARDS the center of the circle,
     //but that is the only way to make it work.
     if (Time.time - startTime >= GlobalManager.timeToCorrectPose)
     {
         return(Quaternion.LookRotation(-new Vector3((float)(-xComponentOfHorizontal * Math.Sin(omega * (Time.time - startTime) + phase)), (float)Math.Cos(omega * (Time.time - startTime) + phase), (float)(-zComponentOfHorizontal * Math.Sin(omega * (Time.time - startTime) + phase))), -CalculateWorldPosition() + new Vector3(centerX, centerY, centerZ)));
     }
     else
     {
         return(correctPoseManeuver.CalculateWorldRotation());
     }
 }
示例#3
0
 public override Quaternion CalculateWorldRotation()
 {
     //Calculate the "forward" direction by taking the derivative of the position with respect to time, removing factors shared
     //by all components of the vector like r and omega
     //The minus sign in front of the vector is because our Hercules model's "forward" direction is in the direction of the tail
     //The bank angle is calculated as that angle which distributes the lift from the plane in the upwards direction and to the
     //center of the circle in the correct proportions, assuming that lift is in the plane's +y direction, with gravity acting
     //downwards and an accelaration of v^2/R = (omega^2)R towards the direction of the circle.
     //The "UnphysicalBankAngle" is added to the calculated bank angle because the calculated bank angle was "too small;" it looks
     //better with a larger bank angle, even though it isn't physically correct
     if (Time.time - startTime >= GlobalManager.timeToCorrectPose)
     {
         return(Quaternion.LookRotation(-new Vector3((float)-Math.Sin(omega * (Time.time - startTime) + phase), 0, -(float)Math.Cos(omega * (Time.time - startTime) + phase)), Vector3.up) * Quaternion.AngleAxis((float)(Math.Atan((r * Math.Pow(omega, 2)) / GlobalManager.gravityMag) * 180 / Math.PI + GlobalManager.unphysicalBankAngle), Vector3.forward));
     }
     else
     {
         return(correctPoseManeuver.CalculateWorldRotation());
     }
 }