//------------------------- PRIVATE -------------------------// private void Update() { // Reads axis inputs from the keyboard float power = Input.GetAxisRaw("Power"); // Spacebar float pitch = Input.GetAxisRaw("Pitch"); // W and S float yaw = Input.GetAxisRaw("Yawn"); // Left and Right Arrow float roll = Input.GetAxisRaw("Roll"); // A and D Debug.Log(power + " " + pitch + " " + yaw + " " + roll); // Flys the quadcopter using the inputs drone.Drive(power, pitch, yaw, roll); // Perform quick flips if (Input.GetKeyDown(KeyCode.DownArrow)) //Down Arrow { drone.FlipPitch(-1); } if (Input.GetKeyDown(KeyCode.E)) //E { drone.FlipRoll(1); } if (Input.GetKeyDown(KeyCode.Q)) //Q { drone.FlipRoll(-1); } if (Input.GetKeyDown(KeyCode.UpArrow)) //Up Arrow { drone.FlipPitch(1); } if (Input.GetKeyDown(KeyCode.T)) //T { drone.gyroStabilization = !drone.gyroStabilization; } }
//------------------------- PRIVATE -------------------------// private void Update() { // Reads axis inputs from the controller float power = Input.GetAxisRaw("LeftY"); // Left Stick Y float pitch = Input.GetAxisRaw("RightY"); // Right Stick Y float yaw = Input.GetAxisRaw("Trigger"); // Analog triggers float roll = Input.GetAxisRaw("RightX"); // RIght Stick X //Debug.Log(power + " " + pitch + " " + yaw + " " + roll); // Flys the quadcopter using the inputs drone.Drive(power, pitch, yaw, roll); // Perform quick flips using the A,B,X,Y buttons if (Input.GetKeyDown(KeyCode.Joystick1Button0)) //A { drone.FlipPitch(-1); } if (Input.GetKeyDown(KeyCode.Joystick1Button1)) //B { drone.FlipRoll(1); } if (Input.GetKeyDown(KeyCode.Joystick1Button2)) //X { drone.FlipRoll(-1); } if (Input.GetKeyDown(KeyCode.Joystick1Button3)) //Y { drone.FlipPitch(1); } if (Input.GetKeyDown(KeyCode.JoystickButton6)) //Back { drone.gyroStabilization = !drone.gyroStabilization; } }