コード例 #1
0
    private static void RotateAilerons()
    {
        float degrees             = currentJoystickCoords.x * DEGREES_PER_JOTSTICK_MOVE;
        var   leftAileronRotation =
            new Vector3(leftAileronStartingRotations.x, -degrees, leftAileronStartingRotations.z);

        leftAileron.Rotate(leftAileronRotation);
        var rightAileronRotation =
            new Vector3(rightAileronStartingRotations.x, degrees, rightAileronStartingRotations.z);

        rightAileron.Rotate(rightAileronRotation);
    }
コード例 #2
0
 // Method moves the flaps objects based on the flaps slider value
 public static void MoveFlaps()
 {
     // Flaps are only moved at low speed, so firstly ensure airspeed is low
     if (throttleSlider.value <= 1)
     {
         // either zero, one or two, so 0, 5 or 10 degrees change
         float degrees      = flapsSlider.value * 5;
         var   flapRotation =
             new Vector3(leftFlapStartingRotations.x, -degrees, leftFlapStartingRotations.z);
         leftFlap.Rotate(flapRotation);
         rightFlap.Rotate(flapRotation);
     }
     else
     {
         flapsSlider.value = 0;  // Reset the flaps slider back to top
         var flapRotation =
             new Vector3(leftFlapStartingRotations.x, 0, leftFlapStartingRotations.z);
         leftFlap.Rotate(flapRotation);
         rightFlap.Rotate(flapRotation);
     }
 }
コード例 #3
0
    // Method rotates the elevators based on the joystick position
    private static void RotateElevators()
    {
        /* rotate around parent objects pivot point on the y axis to the
         * required degrees (20 is the maximum) */
        float degrees = currentJoystickCoords.y * DEGREES_PER_JOTSTICK_MOVE;
        var   leftElevatorRotation =
            new Vector3(leftElevatorStartingRotations.x, degrees, leftElevatorStartingRotations.z);

        leftElevator.Rotate(leftElevatorRotation);
        var rightElevatorRotation =
            new Vector3(rightElevatorStartingRotations.x, -degrees, rightElevatorStartingRotations.z);

        rightElevator.Rotate(rightElevatorRotation);
    }