Search Unity

[Released] cInput 2 - Unitys custom inputmanager got improved !

Discussion in 'Assets and Asset Store' started by Roidz99, Apr 4, 2012.

  1. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I have an update. Installing the driver from here: http://www.microsoft.com/hardware/en-us/d/xbox-360-controller-for-windows
    gave me axis 9 and 10. Without it, and just using the driver that auto-installed when I plugged in the controller the first time, gives you only axis 3. 9 and 10 don't work. This is another piece of obscure info that you might want to put in your PDF :)

    Glad I finally figured it out anyway. Peace!
     
  2. morten_nost

    morten_nost

    Joined:
    Nov 28, 2013
    Posts:
    6
    I don't know if anyone has had exactly this issue before, and I don't know if it is related to cInput after all, but here goes:

    I'm having trouble with sensitivities (mouse, controllers/joypads) being different between multiple scenes as well as more noticeably between editor and standalone builds. It "seems" to be framerate dependent, but I've made totally sure I don't use GetAxis() * Time.deltaTime anywhere in code, still it seems to depend on the current framerate for some reason.
    Also, I'm currently using GetAxisRaw() * sensitivityConstant, but I've also tried using GetAxis() * sensitivityConstant, but I only get the same issues, both with and without applied smoothing/gravity etc.

    Anyone else had a similar issue? If so, how was it fixed?
    Or maybe someone has some ideas to what can be wrong here?

    Please tell me if I need to elaborate or explain the issue better.
    Thanks!
     
  3. fooberichu

    fooberichu

    Joined:
    Jul 19, 2013
    Posts:
    5
    I've been pouring through the forum and your documentation and don't really see anything in particular that treats the iOS/Android topic more than the fact that it is supported. Are you aware of any virtual control suites that work well (easily plug in) to cInput? Do you have any tutorials, demos, or information you can provide to point that direction? I am working on a game that will be cross platform and I'd like it to be as seamless as possible, if possible. Worst case I'll have to use a couple different control suites to handle the different platforms, but best case I'm just missing something here and can be pointed to it.
     
  4. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Hi Morten Nost,

    I'm away from my PC right now, so I can't check the source code, but I'll look more into your issue when I get a chance. Just wanted to mention it here so you don't think I'm ignoring you.


    When we say that cInput works on mobile, what we mean is that it works with physical and virtual keyboards/gamepads. So if your mobile device has a bluetooth keyboard/gamepad, or a physical keyboard, or even the virtual/software keyboard that pops up on scren, you can remap the controls using cInput. cInput does not handle touches, swipes, or gestures.

    Unfortunately, I'm not aware of any touch controllers that work easily with cInput. And honestly I am not sure I see how they would even work well together. Again, cInput is for remapping controls at runtime. It doesn't make sense to me to remap touches or swipes. Touches and swipes/gestures should be fairly intuitive interactions, whereas buttons and joysticks are a bit more abstract forms of control.

    That said, we've been looking into figuring out how to interface cInput with other plugins. Thouogh at this stage, I can't promise anything as it's still very early on in the research stage.

    I hope this helps answer your questions.
     
  5. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I'm glad you got it figured out. When I got my Xbox controller, the first thing I did was install the driver from Microsoft, so I didn't realize that was an extra step in order to get the triggers to show on separate axes. The scary thing about this is that it means that your customers will also need to install that driver or else they'll end up with the same problem. So be sure to include that link in your FAQ when the folks who play your game ask about that. (c:

    I'll update the PDF with that info.
     
    Last edited: Aug 7, 2014
  6. fooberichu

    fooberichu

    Joined:
    Jul 19, 2013
    Posts:
    5
    Deozaan,

    Yeah... I realized late last night that my question was actually pretty stupid. I thought that there might be some virtual inputs that convert their responses into the same event/input system so I could still ask for the same axis or buttons but in reality, it is a different beast. It's not like it'd be all that difficult for me to do branching logic or create my own input wrapper that decides whether it is polling input from cInput or [insert virtual control suite here] depending on the device it is being ran on.

    That being said, I went ahead on cInput more last night after I asked the question and the demo scene worked great but for some reason in my own scene, the input setup was wonky. It mapped the axes just fine but none of the buttons were firing. I noticed in a much earlier post in this thread (page 4 or 5 maybe) somebody reported a similar issue and said that by calling cInput.Clear() before assigning their keys made it work fine. I did that and it also made all my mappings work. Seems rather bizarre and a strange workaround but the fact that it works at least allows me to continue on my merry way.

    Thanks for a great product!
     
  7. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    It seems as though installing the driver to fix the issue may have just been a coincidence. The folks at InControl have had similar issues with the split axes not working, and have posted about their findings here:

    http://www.gallantgames.com/posts/27/details-on-the-xbox-360-controller-bug-in-unity

    I've finally had a chance to look at the source, and as far as I can tell, there is nothing in cInput's code that would make the sensitivity framerate dependent for GetAxisRaw(). But there is smoothing (sensitivity/gravity) based on the framerate using the regular GetAxis(). So I'm not sure what else the problem could be on cInput's end.
     
  8. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Hi folks,

    An update to cInput has been submitted to the Asset Store. If you bought cInput from the Asset Store then the update should be live within a few (business) days. If you bought cInput from our website, then the update is available immediately.

    This update should improve performance and provide some fixes for Xbox triggers.

    cInput changes:

    v2.7.6
    • cInput now uses hash lookups for functions like GetKey, GetAxis, etc. (Thanks Foxxis)
    • Fixed Xbox triggers returning strange values on OSX. (Thanks Warbands)
    • Keys class now returns appropriate axes for Xbox triggers on OSX.
    • Various performance improvements, less loops/iterations per frame.
     
  9. morten_nost

    morten_nost

    Joined:
    Nov 28, 2013
    Posts:
    6
    Yeah, that's what I thought. Just had a tiny hope that you'd maybe heard of something similar before. :(
    Thanks for looking into it, though. Keep up the good work.
     
  10. Seth-McCumber

    Seth-McCumber

    Joined:
    May 26, 2013
    Posts:
    141
    Hey Deozaan, thanks so much for this tool! Its amazing, really. I was wondering if I am aloud to push a commit to my Github repository for my open source game with cInput in it.

    Thanks, DrabWeb
     
  11. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Hey Seth,
    Posting cInput to a open source game with cInput included would be giving out cInput away for free. cInput is not open source so i'm afraid we can't allow that.

    That said, we do have a free development version of cInput,which is a dll that can be freely distributed.
    The only way it differs from cInput (dll) is that it shows a 'nag' screen to state that it is the Development version of cInput.

    If you are interested in this we would be happy to share this Dev dll version of cInput with you...

    I know this is not ideal in a opensource game but i think that's the best we can do. The game will fully function but show a nag every x seconds. I'll talk to Deozaan about this to see if we can have a dev version for you with a more subtile 'nag' if you want.


    PS: just to be sure i'm reading this correct: Your open source game is gonna be shared to everyone who wants to download it ? or just your 'team' working on the game ?
     
    Last edited: Aug 25, 2014
  12. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Just want to inform everyone that cInput is the 24 Hour Deal today !
    You can buy cInput 50% off for 7.50 dollars now !!!
     
  13. b4c5p4c3

    b4c5p4c3

    Joined:
    Jan 4, 2013
    Posts:
    537
    Too bad is not the Pro version. :(
     
  14. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    79
    Does this support plugging a gamepad in at runtime?
     
  15. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    You need to plugin your gamepad before you start your game.
     
  16. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    79
    That's unfortunate. The lack of that functionality is my biggest problem with the default input manager right now, but it looks like it runs a bit deeper than that.

    Do you know why this limitation exists? The most frustrating thing about it is that Unity actually does handle this gracefully, but only when playing from the editor - try to play a release build and the feature mysteriously disappears.
     
  17. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    I agree it's odd behaviour.
     
  18. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    When's the Pro version going on sale?
     
  19. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    To be honnest, we don't know. We submitted it to the 24hour deals but since it was allready featured twice and cInput (dll) was just featured now we have no idea if or when unity will feature cInput pro as 24hour sale.
     
  20. primus88

    primus88

    Joined:
    May 14, 2013
    Posts:
    611
    Can you tell me how can I deny mouse movement for a while? Something like Input.ResetInputAxes?
    I looked in the manual but didn't found a method.
     
  21. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    How do you mean for a while ?

    You want the player being able to use mouse controlls and after a while not ?

    Isn't it better to do this with your inputhandling code ?
    I mean set a bool when the player can use mouse movement and when not ?

    Can you describe me the situation you would want this in ? perhaps it makes things more clear what you want.
     
  22. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Well, I bought the DLL version while it was on sale. When the Pro version comes back on sale again I'll buy it as well. Thanks for the great asset.
     
  23. primus88

    primus88

    Joined:
    May 14, 2013
    Posts:
    611
    Sure.
    For example, I have a cinematic going (which uses a different camera than the main one). After the cinematic ends, it will switch back to the main camera. Well, while the cinematic is on, if you move the mouse around, this will register and show when the cinematic is over and jumps to the main camera.

    Another moment is when player enters a trigger. I want the camera and movement to freeze. I managed to do that with the movement but again camera does not work.

    All I want is to deactivate the cInput camera axes while the cinematic is on.
     
  24. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    I think this is not really a cInput issue but just a issue of when accepting inputs and when not.
    I suggest doing it like this:

    Let's say this is your input code:
    Code (CSharp):
    1. if (cInput.GetKeyDown("Jump") {
    2. // do something with it
    3. }
    I would make a bool first, let's call it allowInputs, then add that bool to all your input code.
    Like this:

    Code (CSharp):
    1. bool allowInputs = true;
    2.  
    3. if (allowInputs && cInput.GetKeyDown("Jump") {
    4. // do something with it
    5. }
    That way, whenever you set the bool to false, your game (so cInput) wouldn't accept any inputs from the player.
    As soon cinematics,cutscenes or whatever are done, you set the bool back to true.

    Ofcourse if there is a input that allows the player to skip the cinematic/cutscene, you wouldn't add the bool to that inputcode.


    I hope this helps, if not let me know.
     
  25. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Will you update this for the new Unity 4.6 gui?
     
  26. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    I think we will make a gui panel for the new unity 4.6+ gui, cant say when. cInput can ofcourse still use the existing guipanel (or you can make your own). I haven't looked at the new gui system yet so i can't say something interesting about it.
     
  27. Eldh

    Eldh

    Joined:
    Nov 22, 2010
    Posts:
    22
    Hi, i recently bought cInput and i was wondering if it's possible to disable the cGUI code ? I saw the line to comment out but i don't have the source code only the dll. Did i miss something or can't i disable it with the regular version (which seems a bit unfair) ?
     
  28. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    cGUI is not beeing used if you don't call it specificly. cInput creates a object in the Hierarchy for it but that's not used unless called for.
    cInput Pro users can comment out that line so it won't create the object but the effect is only visible in the hierarchy and won't give you any benefits besides not seeing it in the hierarchy.
     
  29. Eldh

    Eldh

    Joined:
    Nov 22, 2010
    Posts:
    22
    Ok. I thought creating the cObject was taking quite a long time, and was expecting improving it by disabling the cGUI... But my bad. The scene was taking a long time to load and it was entirely my fault. So... sorry about that.
     
    Last edited: Sep 3, 2014
  30. Mementos

    Mementos

    Joined:
    Sep 25, 2012
    Posts:
    79
    Hey,
    got a problem when using cInput and unitys 4.6 gui. When trying to control the menu (done in 4.6) via the build in system, its not possible to navigate trhough the menu via the horizontal/vertical axis defines in cInput. Only the previous defines axis in the unity input manager works. Any solution for this out yet?
     
    Last edited: Sep 6, 2014
  31. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    I'm not sure what you mean. Can you explain this more please ? Perhaps with a screenshot.
     
  32. Mementos

    Mementos

    Joined:
    Sep 25, 2012
    Posts:
    79
    The new Unity UI in 4.6 supports navigating through the menu via horzintal/vertical axis defined under Edit->PreojectSettings->Input. *So in other words, menus are navigatble via controllers/keyboards)Im using cInput for my application, so i thought i could also navigate the unity 4.6 ui with the horizontal&vertical axis mapped in cInput. But it doesnt work, im only able to navigate by using the buttons original defined in the input settings. Think a screenshot woulndnt show anything, but i could set up an example project if needed
     
  33. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Yes that would be helpfull. I haven't tried out the new gui yet and if you had a example project that would speed things up for sure !
     
  34. V4nKw15h

    V4nKw15h

    Joined:
    Dec 16, 2011
    Posts:
    47
    Hey Deozaan,

    I've been using cIput2 in a commercial product (NeonXSZ) now for over a year and I wanted to let you know that it's worked flawlessly other than a couple of early issues that you already fixed.

    I notice that you don't list Linux support. I have no idea why because it works fine on Linux. I've had zero problems reported from Linux users.
     
  35. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I'm a little puzzled by this. Where are you seeing that we don't list Linux support? Our banner image has Tux on it.

    It might be that we never explicitly stated anywhere that cInput supports Linux because when we first added cInput to the Asset Store Unity didn't yet support making builds for Linux, and when they added that feature, we may have just forgotten to state that cInput works with Linux.

    If you can point out any place specifically that you feel would benefit from an explicit statement of Linux support, we'd love to hear it.

    Thanks!
     
  36. zeman97

    zeman97

    Joined:
    Sep 22, 2012
    Posts:
    53
    So I really enjoy the simplicity of cInput, especially that it has allowed me to develop split-screen multiplayer, however I have one major issue. I cannot for the life of me seem to get the axis settings right, I liked how the axis behaved in the default InputManager, do you have a set value that will make it behave like the original? Currently it feels like my camera is sliding on glass.
     
  37. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    If I understand you correctly, you don't like the sensitivity and gravity settings. If you want the value of the axis without any sensitivity or gravity applied, try using GetAxisRaw().
     
  38. Navid

    Navid

    Joined:
    Sep 3, 2012
    Posts:
    39
    Hi just bought the dll version and it´s great.
    Works perfect with android( rebinding + idroid zombiestan ) but not with ios.
    Did i forget something?
    I`m using ngui and it doesn´t even one show one button during binding.
     
  39. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    cInput should work in iOS. Are you able to see any log messages to check for errors?
     
  40. Navid

    Navid

    Joined:
    Sep 3, 2012
    Posts:
    39
    Does your Demo Scene works with ios?
    Your game starts but i can´t enter menu.
    Does cinput support icade?
     
    Last edited: Oct 1, 2014
  41. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    As I said, cInput should work in iOS. That includes the demo scene. That said, I'm not sure how you'd open the menu in iOS unless you've got some sort of keyboard connected to your device, since you need to press Escape to open the menu in the included demo scene.

    Just to make sure we're on the same page:

    cInput works on mobile devices with real, physical, hardware keyboards or gamepads connected via bluetooth or some other means. It also works with the OS on-screen (virtual) keyboard. It does not handle touches, swiping gestures, or gyroscope input in any way, as it wouldn't make sense to "remap" controls with those kinds of inputs.
     
  42. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Hi folks,

    An update to cInput has been submitted to the Asset Store. If you bought cInput from the Asset Store then the update should be live within a few (business) days. If you bought cInput from our website, then the update is available immediately.

    cInput changes:

    v2.7.7
    • Fixed Dictionary lookup sometimes causing an exception. (Thanks Andre)
    • Fixed possible out of range exception when loading from external string. (Thanks Nick)
    • Setting Keys/Axes now returns the hashcode for easy future reference. (Thanks Foxxis)
    • Added overloaded GetText functions to return empty string instead of None. (Thanks Kurt)
     
  43. sokifilou

    sokifilou

    Joined:
    Apr 29, 2014
    Posts:
    2
    Hi, do you have a demo .exe for this input manager ? I can't run web demo :(
    thanks
     
  44. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Good request! Our web demo page now has a link to download a standalone demo.
     
  45. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Hi,
    I have left the parts using cInput in our project dormant for a while. Now when we use 4.6 something strange is happening. At first I thought it was my fault but now I am not so sure..

    1. Using cInput.ChangeKey(int,int) immediately returns a result even with no input active. I have to troubleshoot this further to ensure I do not have anything sending events. But... :

    2. After cInput.scanning turns false (immediately) we use cInput.GetText(int,int) to get the name of the input bound. To my surprise this now returns the name of the defined key, not the input used?

    Any ideas regarding what is going on here? (This is using 2.7.7) Thanks in advance!
     
  46. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Ok, quick followup: ChangeKey appears to be working if the event chain causing it was NOT started via the new Unity GUI Event System. Have to dig deeper, but the Standalone Input Module in beta 21 and ChangeKey appears not to be compatible at the moment.
    Still don't understand why I get my defined key names back from GetText instead of the key/axis used...
     
  47. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I don't have an answer for you right now why ChangeKey isn't working with the Standalone Input Module in 4.6b21.

    As for GetText(int, int), it returns a different value depending on what you pass in to it. The second parameter is the input. Pass in 0 to get the name you gave to the input. Pass in 1 to get the key/axis used for the primary. Pass in 2 to get the key/axis used for the secondary.

    So for example:

    Code (csharp):
    1.  
    2. cInput.SetKey("Shoot", Keys.Space, Keys.LeftControl);
    3. GetText(0,0); // returns "Shoot"
    4. GetText(0,1); // returns "Space"
    5. GetText(0,2); // returns "LeftControl"
    6.  
     
  48. Chaosgod_Esper

    Chaosgod_Esper

    Joined:
    Oct 25, 2012
    Posts:
    295
    Hi there..
    i´ve a problem with cInput.

    My current Project is in german only (for now). But cInput, its Key-names and Keyboard layout is english only.

    Is there a chance to get European Letters (ßÄäÖöÜü), and a way to RENAME the visual Text for keys in a near update?
     
  49. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108

    Thanks Deozaan!
    I must apologize - both the errors were due to internal errors in our code. An unset variables caused me to send ChangeKey 0 as the first parameter, which in turn meant it immediately returned (since 0 is used as a flag of sorts to detect if scanning is done). Minor point: perhaps ChangeKey should throw an error if it gets passed 0 as an argument?

    So, scanning is indeed working. The same problem caused GetText to return an unexpected value.

    However, to make up for wasting your time I would like to add that cInput can work great together with the standalone module in 4.6b if one simply modifies the module (it is open sourced on GIT by the team, although the code is a bit obsolete). That way you can configure which controls are polled by the module and passed on to the auto navigation for the UI. It works really well!

    Again, sorry for the non-errors!
     
  50. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I don't think this is possible. cInput is a wrapper for Unity's Input Manager. So it uses Unity's key names and KeyCodes for the keyboard layout.

    Great to hear! Thanks! I'll look into adding an error if 0 is passed as an argument.