Hi guys,
In my game, you can choose between using a gamepad for your pitch and roll inputs (it’s a flight game) and using a mouse. The code for setting the input type works just fine, so my problem is something else. Here’s the relevant code:
` ... roll = Input.GetAxis("Roll") * (Time.deltaTime * rollSpeed) * sensitivity; pitch = Input.GetAxis("Pitch") * (Time.deltaTime * pitchSpeed) * sensitivity; yaw = Input.GetAxis("Yaw") * (Time.deltaTime * yawSpeed) * sensitivity; if (controlType == "Mouse") { roll = Input.GetAxis("Mouse X") * (Time.deltaTime * rollSpeed) * sensitivity; pitch = Input.GetAxis("Mouse Y") * (Time.deltaTime * pitchSpeed) * sensitivity; } ... `
When the input is set to mouse input, for some bizzare reason, the mouse only controls only control the player’s pitch. Switching the axis in the code so that Mouse Y controls roll and Mouse X controls pitch (the opposite of how it should be) doesn’t solve the problem, since the mouse still controls only the pitch. I don’t think it has to do with anything else in the code, since the player can roll just fine when using a gamepad. In fact, gamepad controls work perfectly. It’s baffling, to say the least.
MachCUBED