Search Unity

Rewired - Advanced Input for Unity

Discussion in 'Assets and Asset Store' started by guavaman, Sep 25, 2014.

  1. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    That's not how Rewired works. There is no switching going on between keyboards and gamepads. They are both active at all times unless you choose to disable a map or a controller.

    • Create an Action in the editor: "Walk"
    • Create a Joystick Map with Walk assigned to Left Stick X
    • Create a Keyboard Map with "Walk Left" assigned to A and "Walk Right" assigned to D
    • Assign the maps to your Player
    • Create your script that reads input
    • Start your game
    • Whenever the Left Stick on the gamepad is pressed or A or D is pressed your character walks.

    Including such as simplistic demo in the package would just serve to waste space in the user's project. The demos I've included show important features of the system or help illustrate difficult concepts.

    EDIT:
    I just realized, the EightPlayer demo included does already show this. Player 1 can be controlled via joystick and keyboard.

    WASD = Move
    Left Control = Fire

    Rewired does require coding. This is stated on the website. It is not a code-free tool. To make your character walk, you get input just like in Unity:

    Code (csharp):
    1. float walkX = player.GetAxis("Walk");
    2. if(walkX > 0) Debug.Log("Walking Right");
    3. else if(walkX < 0) Debug.Log("Walking Left");
    You can easily try out all the features of Rewired by downloading a free trial from the website. http://guavaman.com/rewired/trial

    Theres a ton of useful information in the documentation on usage:
    http://guavaman.com/projects/rewired/docs/

    Of all the controllers I have mapped for support in Rewired, only one was given to me by the manufacturer. All others, I either bought or another developer bought for me to map. I don't have early access to input products. The SNES30 is not currently available for purchase, so I can't add a definition for it.
     
    Last edited: Mar 25, 2015
    OnePxl likes this.
  2. Alima-Studios

    Alima-Studios

    Joined:
    Nov 12, 2014
    Posts:
    78
    lot of thanks ,

    I have checked it ..

    Im a new buyer !
     
    guavaman likes this.
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Thanks! I hope it helps you make great games!
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Last edited: Apr 10, 2015
    MikeTon likes this.
  5. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    I didn't forget it. Buying this many controllers costs a huge amount of money and mapping them takes a tremendous amount of time. (I've done almost 300 individual mappings across the platforms.) Thankfully, I'm getting a Warthog loaned for mapping next week.
     
  7. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Indeed. I understand.
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Rewired 1.0.0.43 is available for download for registered users now on the website. If you've bought Rewired and want to get access to the latest downloads immediately, contact me with your email address. The update will be live on the asset store in 5-10 days.

    1.0.0.43:
    Changes:
    - Fixed incorrect mappings on Dual Shock 4 controller on PS4.
    - Added workaround for issue with Unity 5 DLL importer settings on platforms not supported in retail Unity distribution (PS4, XBox One, etc.) where these platforms would throw compiler errors on build because the platform checkboxes could not be enabled in Rewired_Core.dll importer by default due to Unity metadata limitations.
     
  9. Alima-Studios

    Alima-Studios

    Joined:
    Nov 12, 2014
    Posts:
    78
    Hi... I have one question..

    Im trying to map keyboard arrows keys to an axis , the behaviour want is a completely digital conversion...

    left key to axis left maximum value , without latency ... etc etc

    to get this im setting the digital axis instant reverse to true and digital axis sensitivity to 300 ..
    IS this the correct way to achieve this ?

    lot of thanks
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Yes. It's the same way you'd do it in Unity's input manager. I usually use 1000 on the sensitivity and gravity.

    But it might be easier if you just use Player.GetButton and Player.GetNegativeButton instead.
     
    Last edited: Mar 28, 2015
  11. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Sorry if this has already been asked, but what are the limitations (differences) of the free trail version?
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    As stated on the trial download page:

    "The only limitation is a 2-minute timeout on during runtime. Each time you start the game the timer is reset so you can evaluate as long as you like."

    Every feature and platform is available for you to try it out and see if it works for you.
     
    Last edited: Mar 28, 2015
  13. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Tanks..
     
  14. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    That is a picture of true controller freedom! Even better since we have native support on Windows so we do not have any limits.
     
  15. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    You must be a ThrustMaster Warthog HOTAS fan. :) I am really amazed at how popular the Warthog is especially among Elite Dangerous fans.

    Actually another ThrustMaster Joystick, the T16000M which is already supported in rewired (as of 1.0.0.35) did not make it to the photo shoot. Hopefully it is included the next time the picture is updated. T16000M. http://www.thrustmaster.com/en_UK/products/t16000m
     
  16. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    That is great news on the Warthog. This will work nicely in @Steve Tack HOTAS templates.
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Oops! You're right. I updated the pic to include it. Good catch!

    Very true. Native support on Windows and OSX is super important to all this flight gear. Without it, most of the HOTAS gear, the flight yokes, and the wheels just don't work well because of the 20 button limit in Unity. With Rewired, they all just work, including any that aren't explicitly supported here as long as the user maps their controls in-game.
     
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Rewired 1.0.0.44 is available for download for registered users now on the website. If you've bought Rewired and want to get access to the latest downloads immediately, contact me with your email address. The update will be live on the asset store in 5-10 days.

    1.0.0.44:
    New Controller Definitions:
    - Thrustmaster HOTAS Warthog Joystick
    - Thrustmaster HOTAS Warthog Throttle
    - Thrustmaster USB Joystick
    - Saitek Pro Flight Cessna Trim Wheel
    - Buffalo FC-801 Famicom USB gamepad

    Bug Fixes:
    - Fixed rare axis calculation issue in RawInput for certain joysticks.



    This update includes the awesome, amazing, and unbelievably heavy Thrustmaster HOTAS Warthog! :cool:

    NewControllers_1.0.0.jpg


     
    Last edited: Mar 30, 2015
    Steve-Tack likes this.
  19. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Rewired is definitely the HOTAS king when it comes to Flight Controllers. The Warthog looks like it could break a few bones if that steel plate fell on your foot.

    Is that Buffalo controller a SNES style gamepad?
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Ouch! I'm sure it would at that.

    The Buffalo controller is this one.

    It's made to look like a Famicom (NES) controller, but it actually has the same number of buttons as a SNES controller. A, B, X, Y, L, R, Select, Start. The D-Pad is a lot better quality than some other NES controller clones I bought. And this controller was actually mappable because it didn't use some ridiculously generic identifying information like some of the others I bought. I also have the SNES version on order.
     
  21. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    The ThrustMaster HOTAS Warthog picture distracted me and I just noticed these other controllers. :D

    That Saitek Cessna Trim Wheel is very popular and nice to have it available for mapping too. I was surprised it worked on Linux but not Android. This is based on your Rewired 1.0.0.44 documentation. (http://guavaman.com/projects/rewired/docs/SupportedControllers.html)

    The Thrustmaster USB Joystick works on both Linux and Android which is good to see.
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    :rolleyes: I updated the pic with all the new controller definitions in the release.

    Since Rewired uses Unity's input system as the input source on Android, it's subject to its limitations. The Cessna Trim Wheel doesn't even show up in the list of joysticks. This was also the case with the Saitek Pro Flight Rudder Pedals and the CH Products Pro Pedals. All three of these devices consist of one or more axes but no buttons. Therefore, I suspect Unity is filtering out devices with no buttons when building the list of HIDs.

    The Thrustmaster USB Joystick is one of the VERY rare cases where a USB joystick actually works fully on Android due to Unity's limitations. It's because it only has 4 buttons and Unity always maps the buttons on standard HID devices that weren't made specifically for Android to button element 15+. This means you have only 5 spaces for possible buttons on these devices. I suspect buttons 0-15 are reserved for Android-specific key codes. This isn't due to any limitations of Android as all these controllers should work perfectly fine on it. It's simply due to the fact that Unity only exposes 20 buttons. I plan on replacing Unity input on Android with a native plugin at some point which will solve all these issues as well as vastly improve hot plugging.
     
    Last edited: Mar 30, 2015
  23. justifun

    justifun

    Joined:
    Apr 2, 2013
    Posts:
    22
    Rewired looks incredible!. I will be purchasing as soon as playmaker support is in there. Any ETA on that?

    Thanks!
     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Thanks! I prefer not to give ETA's. It doesn't do any good for because more important issues tend to pop up that are higher priority throwing everything off schedule.
     
  25. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    (1) You should download the free trial version of Rewired and try it out. It is so amazing to be able to support all of your customers with all of these great controllers.

    (2) A user has made some playmaker actions for rewired so there is something out there in that department. Not something official but better than nothing. See the URL link in this thread (msg #503) for those actions.

    http://forum.unity3d.com/threads/rewired-advanced-input-for-unity.270693/page-11 (see msg #503) .
     
  26. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Thanks for the clarification on why it works they way it does. Looking forward to the new features in Rewired.
     
  27. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551

    Rewired 1.0.0.44 is available in the asset store.
     
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Thanks! I was waiting to announce it because it wasn't showing up there yet. I got the email notice earlier today from the Asset Store but it sometimes takes several hours for the update to actually appear on the site. It wasn't live when I checked about 20 minutes ago. Anyway...

    Rewired 1.0.0.44 is now live on the Unity Asset Store!

    Changes since the last Asset Store update:

    1.0.0.44:
    New Controller Definitions:
    - Thrustmaster HOTAS Warthog Joystick
    - Thrustmaster HOTAS Warthog Throttle
    - Thrustmaster USB Joystick
    - Saitek Pro Flight Cessna Trim Wheel
    - Buffalo FC-801 Famicom USB gamepad

    Bug Fixes:
    - Fixed rare axis calculation issue in RawInput for certain joysticks.


    1.0.0.43:

    Changes:
    - Fixed incorrect mappings on Dual Shock 4 controller on PS4.
    - Added workaround for issue with Unity 5 DLL importer settings on platforms not supported in retail Unity distribution (PS4, XBox One, etc.) where these platforms would throw compiler errors on build because the platform checkboxes could not be enabled in Rewired_Core.dll importer by default due to Unity metadata limitations.


    1.0.0.42:
    API Changes:
    - Added ControllerMap.ClearElementMaps.
    - Added ControllerMapWithAxes.ClearElementMaps.

    Bug Fixes:
    - Fixed bug in controller axis polling detection.


    1.0.0.41:
    New Controller Definitions:
    - Saitek JI3 Cyborg 3D Gold

    Changes:
    - Added Axis Moves One Item option to RewiredStandaloneInputModule to make axes move to the next UI element without scrolling through multiple elements as the axis is held.
    - Added mappings for Sony DualShock 4 on PS4 platform.

    API Changes:
    - Added ReInput.ControllerHelper.PollingHelper.PollAllControllersForAllButtonsDown
    - Added ReInput.ControllerHelper.PollingHelper.PollControllerForAllButtonsDown
    - Added ReInput.ControllerHelper.PollingHelper.PollAllControllersForFirstButtonDown
    - Added ReInput.ControllerHelper.PollingHelper.PollAllControllersOfTypeForFirstButtonDown
    - Added ReInput.ControllerHelper.PollingHelper.PollControllerForFirstButtonDown
    - Added ReInput.ControllerHelper.PollingHelper.PollAllControllersForFirstElementDown
    - Added ReInput.ControllerHelper.PollingHelper.PollAllControllersOfTypeForFirstElementDown
    - Added ReInput.ControllerHelper.PollingHelper.PollControllerForFirstElementDown
    - Added ReInput.ControllerHelper.PollingHelper.PollAllControllersForAllElementsDown
    - Added ReInput.ControllerHelper.PollingHelper.PollControllerForAllElementsDown
    - Added ControllerWithMap.PollForAllButtonsDown
    - Added ControllerWithMap.PollForAllElementsDown
    - Added ControllerWithAxes.PollForAllElementsDown
    - Added Player.ControllerHelper.PollingHelper.PollControllerForAllButtonsDown
    - Added Player.ControllerHelper.PollingHelper.PollControllerForAllElementsDown
    - Added Player.ControllerHelper.PollingHelper.PollAllControllersOfTypeForFirstButtonDown
    - Added Player.ControllerHelper.PollingHelper.PollAllControllersOfTypeForAllButtonsDown
    - Added Keyboard.PollForAllKeysDown

    Bug Fixes:
    - Fixed issue with invalid strings when a joystick returns an invalid product name in Raw Input.
    - Fixed issue with negative axis detection in RewiredStandaloneInputModule.
    - ControllerWithAxes.PollForAllAxes now works correctly.
     
    Last edited: Apr 3, 2015
  29. HiVE-interactive

    HiVE-interactive

    Joined:
    Oct 11, 2013
    Posts:
    14
    Hey guavaman, fresh Unity 5 installation and imported Rewired - Mono is throwing this error:



    The error shows in Mono only and not in the console. Tried to find a solution myself - no avail. Any info?
     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    You've just discovered another rather serious Unity 5 bug.

    Take a look at the references in your editor project in MonoDevelop. Notice that Rewired_Editor.dll isn't there? Unity is not including editor DLLs when it generates the solution files. I imagine this is going to hit every single asset store developer that use editor DLLs. You can add the reference yourself, but Unity will just clear it the next time it compiles.

    I'm afraid there's nothing I can do. Unity's going to have to fix this since. It's not Rewired causing the problem.

    I filed a bug report.
     
    Last edited: Apr 3, 2015
    MikeTon likes this.
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Nevermind. They already fixed it. Download 5.0.1
     
  32. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Hi there :D awesome work on Rewired, it has saved me sooooo much time and works so well ^^ I'm amazed as to how I can unplug/plug controllers with the game running and everything stays working perfectly. One thing I didn't manage to figure out yet is how to use the system controller. I'd like for the menu actions to receive input from all the controllers possible, so I figured it would have something to do with the "System" player, but I didn't quite manage to figure out how to get input from it. Looked at the documentation and other than this : " http://guavaman.com/projects/rewired/docs/Integration.html#unity-ui " I didn't find anything in that sense, so... how can I get input from all the controllers for something like menu? Like getting the Center right button of all controllers to pause/unpause without looking for each specific player?
     
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Thanks! Glad you like it!

    The easiest way to do it is to get the input from all the Players. Remember that you cannot get input for an Action unless you get it from a Player because a Player is the container for controllers and their maps.

    Polling method:
    Code (csharp):
    1. void Update() {
    2.     if(GetButtonDownAllPlayers("Pause")) {
    3.         Debug.Log("Pause!");
    4.     }
    5. }
    6.  
    7. bool GetButtonDownAllPlayers(string name) {
    8.     IList<Rewired.Player> players = Rewired.ReInput.players.Players;
    9.     for(int i = 0; i < players.Count; i++) {
    10.         if(players[i].GetButtonDown(name)) return true;
    11.     }
    12.     return false;
    13. }
    Event method:
    Code (csharp):
    1. void Awake() {
    2.     IList<Rewired.Player> players = Rewired.ReInput.players.Players;
    3.     for(int i = 0; i < players.Count; i++) {
    4.         players[i].AddInputEventDelegate(OnPausePressed, UpdateLoopType.Update, InputActionEventType.ButtonJustPressed, "Pause");
    5.     }
    6. }
    7.  
    8. void OnPausePressed(Rewired.InputActionEventData data) {
    9.     Debug.Log("Pause!");
    10. }
    If you're using Unity UI, the RewiredStandaloneInputModule has an array for you to enter each Player Id you want the UI to receive action from and a checkbox for the System player.

    If you really want to get a value from all controllers from System player, you'd have to assign all joysticks to System manually at start and on connect. Make sure you don't de-assign them from the Player that they were auto-assigned to when you assign them to System.

    http://guavaman.com/projects/rewire..._Rewired_ReInput_ControllerConnectedEvent.htm
    http://guavaman.com/projects/rewire...d_Player_ControllerHelper_AddController_1.htm

    Code (csharp):
    1. void Awake() {
    2.   Rewired.ReInput.ControllerConnectedEvent += OnJoystickConnected;
    3.   Rewired.Player system = Rewired.ReInput.players.SystemPlayer;
    4.   foreach(Rewired.Joystick joystick in Rewired.ReInput.controllers.Joysticks) {
    5.     system.controllers.AddController(joystick, false);
    6.   }
    7. }
    8.  
    9. void OnJoystickConnected(Rewired.ControllerStatusChangedEventArgs args) {
    10.   Rewired.ReInput.players.SystemPlayer.controllers.AddController(args.controllerType, args.controllerId, false);
    11. }
    12.  
    13. void Update() {
    14.   if(Rewired.ReInput.players.SystemPlayer.GetButtonDown("Pause")) {
    15.     Debug.Log("Pause!");
    16.   }
    17. }
     
    Last edited: Apr 4, 2015
    MikeTon likes this.
  34. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Thanks for the quick and awesome support \o The Polling method sounds like a good solution for me :) Will try it. I'm stuck with NGUI for the time being, still not ready to make the jump to newer versions of Unity XD
     
  35. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Rewired 1.0.0.45 is available for download for registered users now on the website. If you've bought Rewired and want to get access to the latest downloads immediately, contact me with your email address. The update will be live on the asset store in 5-10 days.

    A couple of important changes in this update:
    • Fixed issue on OSX when hot-plugging with multiple identical controllers.
    • Re-enabled Windows App Store installer for Unity 5.0.1+ due to critical bug fix by Unity 5.0.1 that allows Windows App Store support to work again.

    Release Notes:

    1.0.0.45:


    New Controller Definitions:
    - Mad Catz Micro C.T.R.L.R
    - Buffalo BSGP801 Classic USB Gamepad (SNES)

    API Changes:
    - Added ReInput.MappingHelper.UserAssignableActionsInCategory(int categoryId, bool sort)
    - Added ReInput.MappingHelper.UserAssignableActionsInCategory(string categoryName, bool sort)
    - Added ReInput.MappingHelper.ActionsInCategory(int categoryId, bool sort)
    - Added ReInput.MappingHelper.ActionsInCategory(string categoryName, bool sort)
    - Added Player.ControllerHelper.MapHelper.AddEmptyMap<T>(int controllerId, string categoryName, string layoutName)
    - Added Player.ControllerHelper.MapHelper.AddEmptyMap(ControllerType controllerType, int controllerId, string categoryName, string layoutName)


    Bug Fixes:
    - Fixed issue on OSX when hot-plugging with multiple identical controllers.
    - Fixed issue with ReInput.MappingHelper.UserAssignableActionsInCategory.
    - Fixed issue with ReInput.MappingHelper.UserAssignableActions.
    - Fixed error in Sony PlayStation Vita controller definition.

    Other:
    - Re-enabled Windows App Store installer for Unity 5.0.1+ due to critical bug fix in Unity 5.0.1 that allows Windows App Store support to work again.




    BuffaloSNES_CTRLRMicro.jpg
     
    Last edited: Apr 10, 2015
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Rewired 1.0.0.46 is available for download for registered users now on the website. If you've bought Rewired and want to get access to the latest downloads immediately, contact me with your email address. The update on the Asset Store will be delayed because 1.0.0.45 is still in the process of being approved. 1.0.0.46 should be live in 10-20 days.

    1.0.0.46:
    New Controller Definitions:
    - Saitek X52 / X52 Pro Flight Control System

    Modified Controller Definitions:
    - Added mouse nub support to Saitek X55 Rhino Throttle

    Changes:
    - Added option to exclude a Player from joystick auto-assignment in the Rewired Editor.
    - Changed RawInput to detect additional axes.
    - Changed OSX Native to detect additional axes.
    * IMPORTANT * If you've created your own controller definitions, be sure to verify and update the axis and button count values for Raw Input and OSX native in the Matching Criteria as this update may cause the axis and/or button count to return more elements than before.

    API Changes:
    - Added Player.ControllerHelper.excludeFromControllerAutoAssignment.

    Bug Fixes:
    - Recognized controllers with no joystick maps defined no longer load Unknown Controller map.
    - Joysticks are no longer assigned back to the previous owner on re-connect if Auto-Assign Joysticks is disabled.



    HOTAS is pretty well covered.


    hotascontrollers.jpg
     
  37. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Rewired has always had great Flight Controller support but full HOTAS support is outstanding! Cannot wait to get this update.

    The HOTAS picture is perfect.
     
    guavaman likes this.
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Rewired 1.0.0.47 is available for download for registered users now on the website. If you've bought Rewired and want to get access to the latest downloads immediately, contact me with your email address. The update on the Asset Store will be delayed because 1.0.0.45 is still in the process of being approved. 1.0.0.47 should be live in 8-18 days.

    1.0.0.47:

    New Controller Definitions:
    - Thrustmaster F430/T100 Racing Wheel

    Changes:
    - Improved performance of all editor windows.



    ThrustmasterT100_F430.jpg
     
    Last edited: Apr 10, 2015
  39. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    That is 6 new controllers this week. I same sure @Steve Tack is going to like the X-52 HOTAS systems included.

    Nice to see a few extra wheels being included.
     
  40. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    386
    Kimi is excited by that last wheel!
     
    Steve-Tack likes this.
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    LOL! That's a good one.
     
  42. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Indeed! Not sure how I missed that post. Having X-52 and X-52 Pro profiles is sick!!! All of the major HOTAS devices are supported at this point it seems.
     
  43. JakeTBear

    JakeTBear

    Joined:
    Feb 15, 2014
    Posts:
    123
    Hey guavaman,

    I bought Rewired when it came out but I never had the chance to really use it, the chance finally presented itself and I am very happy with it, I been playing with it for about an hour now and it is very good! there is tons of documentation and thats always nice, I havent been able to find something though (since there is a lot of information), it seems trivial but I want to avoid having to pass strings to get the actions, I see there is an argument for passing an int ID instead of a string to get the state of that action from the player (players can be cached nicely, all good!).

    I thought I could get the action id with something like "Player.GetActionId(string name)" but it seems is not there. There's obviously a way of achieving this, can you point me in the right direction please?

    Thanks a lot, and keep up the amazing job you have done so far.
     
  44. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Thanks!

    An Action is not part of a Player. You access it through ReInput.mapping.

    http://guavaman.com/projects/rewire...Rewired_ReInput_MappingHelper_GetActionId.htm

    You can also see the id in the Rewired Input Manager.
     
  45. JakeTBear

    JakeTBear

    Joined:
    Feb 15, 2014
    Posts:
    123
    Ah there we go, absolutely perfect, thanks a lot!
     
  46. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    I think we are HOTAS complete with Rewired.

    Did you see that @guavaman updated the picture of all of the controllers in his first message? It is amazing how many controllers Rewired supports and more importantly the huge variety of the controller types (light guns, racing wheels, ship console, Flight controllers [ yokes / rudder pedals / throttles / 7 HOTAS systems / trim wheel and TPM ] and of course a endless sea of gamepads).

    http://forum.unity3d.com/threads/rewired-advanced-input-for-unity.270693 (msg #1)
     
    Last edited: Apr 12, 2015
  47. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    The only one missing is the CH Combatstick. I know there's support for CH Fighterstick, but it seems that the Combatstick is actually a different joystick. I have no idea how common those are compared to the Fighterstick.
     
  48. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    They are two different devices. FighterStick is the more expensive of the two. FighterStick has more HATs and CombatStick has traded out HATs for single buttons. I think FighterStick is more popular since many stores (mainly those that cater to flight simulation markets) seem to only stock FighterStick and not the other two sticks by CH (CombatStick and FlightStick).

    CH website (http://www.chproducts.com)

    This has a good overview and good pictures of CombatStick and FighterStick on these two pages.

    http://www.simhq.com/_technology2/technology_014c.html

    http://www.simhq.com/_technology2/technology_014d.html
     
  49. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
  50. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Ran into an obscure issue when allowing more than one joystick per player.

    Until yesterday, I had left the Max Joysticks Per Player at 1. For all of the controllers I own, that has worked fine. But @longroadhwy tested my game with a separate CH stick and throttle, which wouldn't both work at the same time until I bumped that up. I went with 4. At that point, the throttle, stick, and even a 360 pad all plugged in at the same time apparently worked just fine. Great!

    The issue is with my method for determining on-screen input icons (glyphs). In a few weird cases, I need to get to the action and axis contribution, for example, one half of the map zoom axis. I get the list of axis contributions per action by calling this:

    Code (csharp):
    1. var actionElementMapList = player.controllers.maps.ElementMapsWithAction(controller.type, inputGlyph.Action, false);
    When I have two joysticks for my one player connected and try to iterate through the list by doing this...

    Code (csharp):
    1. foreach (var item in actionElementMapList) {
    ...I get an ArgumentOutOfRangeException: Argument is out of range. Parameter: index.

    Is this an obscure bug? Or should I be doing something differently? It works in the case of buttons where I call:
    Code (csharp):
    1. ActionElementMap actionElementMap = player.controllers.maps.GetFirstElementMapWithAction(controller.type, inputGlyph.Action, false);
    and it works when there is one joystick for the player.