

When i flip the two if statements in the ChangeMovementSpeed() method, this time walking and running works but not sprinting. I've got my character to walk and sprint, but not running. I'm making my own first person controller and I want to have 3 movement speeds: walk, run and sprint. Transform.localRotation = Quaternion.Euler(xRotation, yRotation, zRotation) Vector3 move = ((transform.right * x) * yzAxisSpeed) + (transform.forward * currentSpeed) + ((transform.up * y) * yzAxisSpeed) ĬurrentSpeed -= accelRate * ltaTime įloat mouseZ = Input.GetAxis("Mouse X") * xMouseSensitivity * ltaTime įloat mouseY = Input.GetAxis("Mouse Y") * yMouseSensitivity * ltaTime įloat turnX = Input.GetAxis("Yaw") * zTurnSpeed * ltaTime Start is called before the first frame updateĬursor.lockState = CursorLockMode.Locked

Public class FlightControl : MonoBehaviour is a link for a video demonstrating what's happening, and below, I have supplied my code: No matter what, pulling up or pushing down on the mouse Y axis only rotates the camera/transform on the global X axis, despite using the localRotation variable.

The pitch only works as intended when the camera is at 0 degree rotation on the Z axis. I have throttle, yaw, pitch, and roll implemented aside from one hitch. I decided to play around with making a character controller for a flight sim type of game.
