Search Unity

HID Compliant Game Controller

Discussion in 'Scripting' started by khanstruct, Jan 11, 2018.

  1. khanstruct

    khanstruct

    Joined:
    Feb 11, 2011
    Posts:
    2,869
    I'm working on the character and camera controls for my game. I'm still a ways off from that, and I'm sure I'll be back for more advice. What I eventually want to happen is to have the left joystick move the character (up will always move them away from the camera), and the right stick control the camera's orbit around the character.

    Now, I have most of it working... kinda. But when I tried to code the camera movement on the right stick, it gets all kinds of screwy. Basically, the game is reading the right stick as permanently pressing up and left.

    I did some research and discovered that this is due to the HID Compliant Game Controller driver. Fine. I disabled it. But now it won't recognize the controller at all.

    Is there some other driver I should be using? And can I expect this to be an issue for players that use this standard driver?
     
  2. WarmedxMints

    WarmedxMints

    Joined:
    Feb 6, 2017
    Posts:
    1,035
    If you target platform is windows then most will be using an xinput controller. Personally, I@m not a fan of Unity's input system so I wrote a c# wrapper for the xinput dll a while ago and just use that for all my controller inputs.

    Even if they are not using an xinput controller, steam will setup their controller to emulate one.
     
  3. khanstruct

    khanstruct

    Joined:
    Feb 11, 2011
    Posts:
    2,869
    Ah, thanks. Ok, my initial target platform will be Windows/Steam. But if I do want to move to console later, I'd have to rework the code for that?

    Also, I'm currently testing using a PS4 controller. Is there some driver I should be using that won't involve an ugly workaround?
     
  4. WarmedxMints

    WarmedxMints

    Joined:
    Feb 6, 2017
    Posts:
    1,035
    Everything is an ugly workaround when dealing with dualshock controllers. Imo, the best place for them is in the bin!

    Iirc, Sony never produced decent windows drivers for the DS4 when connecting it directly via usb. However, they did release a wireless dongle, which is nothing more than a glorified bluetooth dongle, and using that allows you to use drivers which are better than the standard hid ones.

    When it comes to pc gaming though, especially on windows, your best bet is to throw it away and use an xbox controller.
     
  5. khanstruct

    khanstruct

    Joined:
    Feb 11, 2011
    Posts:
    2,869
    Well, that kinda sucks. I suppose I'll have to go out a pick up an XBox controller for development. On a mostly related note, any idea why WASD and the Arrow keys wouldn't work as alternative buttons. I've entered them correctly as the negative and positive buttons in the Input Manager. Am I missing something?
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,625