void HandlePlayerInput() //function to get and handle mouse input { //get Axis input mouseX += Input.GetAxis("Mouse X") * X_MouseSensitivity; mouseY -= Input.GetAxis("Mouse Y") * Y_MouseSensitivity; //check for controller input if (Input.GetAxis("RightJoyHorizontal") > deadZone || Input.GetAxis("RightJoyHorizontal") < -deadZone) { mouseX += Input.GetAxis("RightJoyHorizontal") * X_MouseSensitivity; } if (Input.GetAxis("RightJoyVertical") > deadZone || Input.GetAxis("RightJoyVertical") < -deadZone) { mouseY -= Input.GetAxis("RightJoyVertical") * Y_MouseSensitivity; } //Limit mouse Y rotation here mouseY = HelperK.ClampAngle(mouseY, Y_MinLimit, Y_MaxLimit); }
//Handle the players mouse inputs, and respond accordingly. Handles Controller input as well. void HandlePlayerInput() { //get Axis input mouseX += Input.GetAxis("Mouse X") * X_MouseSensitivity; mouseY -= Input.GetAxis("Mouse Y") * Y_MouseSensitivity; //check for controller input, and replace mouse values with controller inputs if (Input.GetAxis("RightJoyHorizontal") > deadZone || Input.GetAxis("RightJoyHorizontal") < -deadZone) { mouseX += Input.GetAxis("RightJoyHorizontal") * X_MouseSensitivity; } if (Input.GetAxis("RightJoyVertical") > deadZone || Input.GetAxis("RightJoyVertical") < -deadZone) { mouseY -= Input.GetAxis("RightJoyVertical") * Y_MouseSensitivity; } // Limit mouse Y rotation here, so we can't go over the top of our own head. X is not required and we can spin in circles as much as we want. mouseY = HelperK.ClampAngle(mouseY, Y_MinLimit, Y_MaxLimit); }