Cinemachine 2.6.10 FreeLook Camera not rotating with Gamepad stick

I am using Cinemachine 2.6.10 and I have the following problem:

  1. My FreeLook Camera is rotating using mouse, but not rotating using Xbox One controller Right analog stick.
    I tried different configurations, but still no luck:
  • changing Action Type and Control Type
  • using Cinemachine Input Provider

You need to use a much higher speed, because with the joystick the input values are 0…1 while with the mouse they are much higher.

1 Like

I have increased maxSpeed, but still no luck. The FreeLook Camera is not rotating with Gamepad Right stick. Only Mouse rotation is working.

My Rotate Action data is:
Action type = Value
Control type = Vector2

Have 2 bindings:
Keyboard and mouse : path = Delta Mouse
Gamepad : Path = Right stick [Gamepad]

I have added Cinemachine input provider: XY Axis = Rotate Action

Character movement with gamepad is working fine (with Left stick)
Rotating Cinemachine camera is not working with Right stick.


I also tried speed Input Value gain. I have noticed that in previous versions there was an Axis field = Mouse X and Mouse Y, that some people overwrite, but I think in newer version Cinemachine input provider should do this job.

Please, advice me, where could be the problem. I am using new input system + newest Cinemachine version.

This is likely to be an issue in how you set up the input. The mouse delta will give large values per frame, while the joystick will give a max amplitude of 1. You can add processors to the input channels to normalize the values so that the vcam will see the same thing regardless of where the input is coming from. In play mode, you can move the input and look at the vcam inspector to see the input axis values change. That might help you debug.

7550959--933490--upload_2021-10-6_8-28-5.png

I have added Normalize Vector2 processor, unfortunately Input Axis Value is always zero with Right Analog Stick. Only mouse is working.
When I click LISTEN to add the binding path, right stick is recognized successfully.
My configs are attached. Should I try same controls on new project or try with Old input system for test?
or somehow to downgrade to lower Cinemachine version. Now I am using newest 2.6.10

I suggest that you add some debugging to figure out what the input system is giving you. Since it works with the mouse it suggests that the infrastructure (input → input provider → freelook) is functioning. You can copy CinemachineInputProvider and modify the copy to display the values being sent from the input system.

I created a copy of CinemachineInputProvider and added some logs:

  1. It is strange why at the very beginning CINEMACHINE_UNITY_INPUTSYSTEM = false. I have New input system installed. (I reversed CINEMACHINE_UNITY_INPUTSYSTEM during the test).
  2. action.ReadValue().x and y are always 0 when using Xbox Gamepad Right stick. Using mouse I got value.
  3. m_cachedActions[axis] is always Player/Rotate[/Mouse/delta]

If I use:

controls.Player.Rotate.performed += OnRotate;

public void OnRotate(InputAction.CallbackContext context)
{
Debug.Log(context.ReadValue());
}

I receive input for both Mouse and Right stick. Should I made some custom code to rotate cinemachine camera or it should work automatically without OnRotate

I copied your input setup from CM1.png. For me, the input worked with both an xbox controller and a mouse. I tested in 2020.1, and using CM 2.6.10.

I noticed, that the mouse works even if I click outside the Game Window, whereas the xbox controller does not. Could it be that?

Or could it be that your input is not working, because of Use in control scheme?

Thank you very much for your help. CASE CLOSED.

  1. I created new Unity project with same version 2020.3.18, and Cinemachine FreeLook Camera rotation was OK with Gamepad right stick.
  2. I copied this working test Scene to my Original project, to test there as well and rotation WAS NOT WORKING.
  3. Then I remove FreeLookCamera and CinemachineBrain and added them again. And it was working.

So maybe I had this strange issue, because I copied these configurations from my test scene to another scene, or copied whole scene directly. Now it is working fine.
Thank you a lot for your help!!!

In my case, that’s what just happened. The right stick didn’t work with control schemes, but when i removed them all, it worked just fine.

The settings i was working on are:
Unity 2019.4.39f
Input System 1.3.0
Cinemachine 2.6.15

Another thing: when my controller is connected from the beginning (that is, when i press play), cinemachine detects the right stick, but when i connect the controller AFTER i press play, it doesn’t detect the stick, even though the Input System detects it without issues.

UPDATE: this issue also happens on Unity 2021.3.3f

I tried to do a repro but to me looks fine. Could you install the simple demo sample of the Input system package (Window → Package manager → Search Input System → Samples → Simple demo)? There is an Input action asset. What happens if you use the Gameplay/Look for XZ axis on Cinemachine input provider? In my case it works (2021.2.12). If you don’t have issues with this asset what is the difference between yours and the sample?

Let us know :slight_smile: .

For this one it might be an editor feature. If your game view is not focused when you plug the controller it does not refocus it. This allows to click in the editor field without messing up with your game. When you plug your controller if your game view is not focused it assume you are still clicking an editor window and not the game. Click the game view and it will work. I checked this only happens in editor you don’t have to do this in build.