Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Will dual shock controllers and x box controller triggers return the same range?

Discussion in 'Input System' started by DouglasPotesta, Nov 5, 2018.

  1. DouglasPotesta

    DouglasPotesta

    Joined:
    Nov 6, 2014
    Posts:
    109
    Dual shock controller triggers return -1 to 1 range, while x box controller triggers return 0 to 1 range. I understand this is more specific to the controllers themselves returning these values. However it would be pretty nice if the new input system could provided some support to remap one range to the other to make it consistent.
    Thoughts?
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Are you thinking of a specific API here? As far as the PS4 DualShock controller goes, the HID itself returns the triggers as unsigned byte values, i.e. in the range of [0..255].

    Yup :) The Gamepad layout in the system mandates the triggers to consistently go [0..1].
     
    DouglasPotesta likes this.
  3. DouglasPotesta

    DouglasPotesta

    Joined:
    Nov 6, 2014
    Posts:
    109
    Sorry I should have mentioned that this was with the old input system. I am writing a tool for handling inputs that allowed for creating platform specific controller configurations. I stumbled across this hitch and figured I'd check if the new input system was going to operate the same way.
    This sets my mind at ease. Thanks for getting back to me.
     
  4. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Oh right. Didn't think of that. Yeah, IIRC the old system normalizes all HID axes to [-1..1] with the midpoint at half in the value range and doesn't really know whether it's dealing with a trigger axis or stick axis. So the DualShock ends up with [-1..1] triggers whereas the Xbox controller, which is ignored as a HID and picked up through XInput instead, comes out correctly as [0..1].

    The new system doesn't look at the DualShock controller as just a generic HID joystick like the old system does. So the triggers get properly normalized to [0..1] whereas the stick axes get normalized to [-1..1].
     
  5. DouglasPotesta

    DouglasPotesta

    Joined:
    Nov 6, 2014
    Posts:
    109
    Will those hold true for those wonky controllers like the nvidia shield controller and the Logitech gaming controller.
     
  6. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    In the first version of the new system, our range of hardware support will be limited. Meaning there will still be gamepads that we do not explicitly support and that will get picked up as generic HIDs.

    Logitech gamepads should be fine except if fairly old models. Logitech's been doing them all as XInput gamepads for quite a while now. Older ones that are DirectInput only or if switched to DirectInput mode (for those gamepads that support both modes), however, will not work properly.

    Not sure about the Shield. We do support it properly on Android but on the PC, I don't know how Nvidia is setting up the controller. We'll have to try one. If they are simply posing as an XInput controller like the Logitech gamepads, it should work out of the box as expected (at least when using wired via USB; not sure about when used wirelessly via Bluetooth). If not, it won't work properly.

    Overall, we'll be pushing for broader hardware support after 1.0 has shipped and the more widely used stuff like the Shield controller or the JoyCon will certainly see support added for PC.
     
  7. DouglasPotesta

    DouglasPotesta

    Joined:
    Nov 6, 2014
    Posts:
    109
    Cool can't wait. I'll start messing around with the system then. Based on your updates and peoples feedback, this really feels like the future de facto input system.