Search Unity

Why RawInput and Not Direct Input? Any advice?

Discussion in 'Editor & General Support' started by devotid, Apr 10, 2012.

  1. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Im having problems with NON-XBOX 360 controllers. .....my customers will have older style controllers and USB inputs so Im testing an bunch of "older joysticks and controllers" that normally work great with most all games using DirectInput.
    But for some reason NONE of my controllers will read DIrect Input with Unity stand alone games. They "seem" to use RawInput instead. So my cars are never driving straight or idling good. I always have to adjust the input multiplier to just make the controller reach full lock. (I'm sure thats RAWInput NOT Direct)
    If i unplug and use keyboard and its fine. you get the idea. So......

    I saw this post by Andeee (below in red) and wondered if anybody could tell me were and how to put the files in a stand alone build for PC. and do my customers need to do anything after downloading my game to make it work properly? or does this fix just do something to the game itself and not the persons computer or registry?

    Sorry for all the questions......im just in need of help badly.

    or any other ideas how to get Unity to read the Direct Input instead of raw input?

    Im also looking for a ingame calibration system if the Direct Input option is not available.

    Thanks very much for any help you can offer.

    Kevin
     
  2. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    this is the post im talking about with the reg files attached.

    here is link to original post http://forum.unity3d.com/threads/58016-Joystick-calibration

    plus more of the same prob..... here http://forum.unity3d.com/threads/67906-Gamepads-and-GetAxisRaw


    __________________________________________________ ________________

    ""OK, I've run this past Unity's Windows guru, Ignas, and here is what he has to say about the matter:-

    Originally Posted by Ignas
    No, you can't read the joystick's calibration data. Unity reads input on Windows using either RawInput (default) or DirectInput. This seems to be a bug in RawInput (DirectInput works fine). I'll only be able to fix this after 3.0.

    If you are targeting the standalone player you can try forcing DirectInput by executing "SetDirectInput.reg" script (see the attachment). "ResetInput.reg" resets to default.
    Attached Files
    regfiles_234.zip (2.3 KB, 178 views)]""


    __________________________________________________ ____________________
     
  3. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    nudge...nudge...

    oops did i do that?
     
  4. lockbox

    lockbox

    Joined:
    Feb 10, 2012
    Posts:
    519
    Some reading material...

    Using XInput.dll with JavaScript.
    http://forum.unity3d.com/threads/98196-Using-XInput.dll-with-JavaScript.

    Interfacing with a Joystick using C#
    http://www.codeproject.com/Articles/16704/Interfacing-with-a-Joystick-using-C

    Comparison between XNA and DirectX (C#)
    http://stackoverflow.com/questions/514872/comparison-between-xna-and-directx-c

    How to use DirectX.DirectInput in XNA
    http://stackoverflow.com/questions/5604492/how-to-use-directx-directinput-in-xna

    Taking input from a joystick with C# .NET
    http://stackoverflow.com/questions/3929764/taking-input-from-a-joystick-with-c-sharp-net

    WPF: How to implement joystick as alternative input device (C#)
    http://stackoverflow.com/questions/...lement-joystick-as-alternative-input-device-c

    [C#] using UnityEngine; using XInputDotNetPure; // Required in C#
    http://pastebin.com/MAAvSVDU
     
  5. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    If i could kiss you i would....... is that to far lockbox? lol

    But now i have reading to do.....

    Thanks again

    Kevin
     
  6. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    325
  7. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    great...... (sarcasm)

    Thanks very much for this valuable info.

    sh0v0r: Also your simulation is Beautiful...Great Job!

    im developing a game solely made for "usb" generic controllers similar to yours......actually Remote Control transmitters and Generic USb input dongles handled all through Windows Direct Input......hopefully.

    I just tried the registry key thing and no inputs work at all..(3.5.1)..... so i just reset it again and its back to normal.

    Does the cInput plugin your using actually help? (or offer calibration at all?) or does it just allow realtime (ingame) controller configrations of the "garbage" RAW input?

    Im just about to purchase 3.5.1 unity Pro. Should i NOT?

    do you think any of the above options from lock box would work at all with 3.5.X?

    UGH....i am seriously about to switch game engines....... and im two weeks away from launching..... CONFUSED.

    Kevin.
     
  8. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    325
    cInput just allows you to remap in game since Unity still does expose the input manager to scripting.
    The Registry fix allows windows to properly utilise the drivers calibration which ensures most controllers will function properly.
    This is a critical requirement for my game and it's player base.
    I am still using 3.4 because of this and it is causing some issues because anyone that buys my game on Steam it will automatically install the registry key. Then anyone Unity applications compiled with 3.5 will not have functioning input.
    I am not going to change my game because it is more important to me that my players can play my game properly.
     
  9. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    the latest version of cInput2 allows you to callibrate your joysticks.

    The callibration works like this. click on callibrate (or use the function if you make your own menu),then cInput will ask you to leave your controller at the 'rest' position and click on ok. From then off cInput considers that point to be the '0' position.

    You can ofcourse also set the deadzone to 0.001 or something if the controlls are too sensitive.

    Feel free to mail us any questions.