Search Unity

How do I setup CM Freelook w/ Unity New Input System to work for both mouse and gamepad?

Discussion in 'Cinemachine' started by JacquesJ, Jul 26, 2020.

  1. JacquesJ

    JacquesJ

    Joined:
    Jul 26, 2019
    Posts:
    7
    Hey guys, as the title says, I'm trying to setup CM Free look w/ Unity New Input System to work for both mouse and game pad.

    I'm making a 3rd person game so I'm also using the camera collider extension on the Free Look camera.

    I've prototyped it out myself and got all the controls set up correctly in the new input system but I'm facing two problems:

    1. I couldn't get the camera to work for both the mouse and game pad stick, I had to make unity use both the old and new input system and use the old system for the mouse and the new system for the game pad in order to use both.
    2. Right now the game pad camera sensitivity is usable but the mouse sensitivity is very low and not usable.

    My questions:

    1. How do you guys recommend I go about setting this up correctly?
    2. Both the mouse keyboard controls are active at the same time as the game pad, how to I only have 1 active at a time based on which one is being used?
    3. Do I need separate cameras or separate settings I need to apply depending on if the mouse or game pad stick are being used to get the sensitivity to be appropriate for each of them?

    Thanks guys! Sorry if any of my questions are dumb I am a cinemachine n00b.
     
    Last edited: Jul 26, 2020
  2. patbaril

    patbaril

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    16
    Hello, let me do some research on the New Input System and I will get back to you as soon as possible.
     
  3. JacquesJ

    JacquesJ

    Joined:
    Jul 26, 2019
    Posts:
    7
    Thank you very much @patbaril !
     
  4. patbaril

    patbaril

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    16
    Hello again, my understanding of the New Input System is very basic but here is what I found that could hopefully help you.
    When installing the New Input System package, I imported the Simple Demo. From this sample, I used the Player and made a prefab out of it so I could use it (along with the SimpleController_UsingPlayerInput and PlayerInput) in my new scene. I remove the camera component from the Player prefab and added a cube instead. Now when I go in Play Mode, I can control the Cube and make it rotate with the mouse.

    I added a Cinemachine FreeLook camera to my scene. Don't forget to add the Cinemachine Input Provider component. In the Cinemachine Input Provider I used gameplay/look for the XY axis. These are linked to the SimpleControls file imported from the Simple Demo. Double-clicking on this file opens up the configuration for it.

    If you expand look, you have the current input device set. So I guess that if you put both mouse and gamepad device there, they should both control the FreeLook Camera.

    For your sensitivity problem, you can add a Scale Vector for each device, adjusting it should bring you proper behavior for both mouse and gamepad.

    upload_2020-7-28_15-13-58.png

    Let me know if this is of any help to you. If not, let me know and I will do more research on my side.
     
    Gregoryl likes this.
  5. Binary42

    Binary42

    Joined:
    Aug 15, 2013
    Posts:
    207
    Did you get that working? As i understand the Cinemachine Input Provider works with a delta value but the Sticks deliver absolute values?