Search Unity

Rewired - Advanced Input for Unity

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

  1. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Sorry ... I should have waited. :)

    In the X-plane forums that seems to be regular question about force feedback controllers. People had some of the older USB controllers that had force feedback. For example like this Logitech model.

    Logitech 940 flight system info can be found here.

    http://support.logitech.com/en_us/product/flight-system-g940
     
    guavaman likes this.
  2. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    There are few users who had the Iris Dynamic yokes and switched to the Brunner model which they say is much better. That is based on the X-plane forum comments I have seen.

    Here is the discussion on the X-plane forum for reference.

    http://forums.x-plane.org/index.php?/forums/topic/85755-force-feedback-yoke/&

    The force sensing sticks like the discontinued Saitek X-65 was also very interesting. I wish I could have found one of those before it was discontinued.

    I would like to see those BugEye technologies F-16 desktop controls in action. I expect those are force sensing like the real F-16 controls.
     
  3. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
  4. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    Yeah, it'd be a mess. Probably better to not worry about it unless you have some kind of pressing need for a specific controller type.

    Something like that, yeah.

    Might have to store additional, specific data, so it'd likely be better for the future if it was some ScriptableObject or Asset file.

    I'd forgotten about VR, but that'd be a big one for sure. Seems like it'd be more important as you'd strive for move realism with the vibrations in a VR environment.
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    For a complete system, yes. I was suggesting it for casual use in your own project as a quick way of having a portable animation curve. A vibration effect file format would have to take quite a few variables into account, especially on certain console platforms. If you wanted it to be one global format for all platforms, it would need to account for all the varied capabilities.
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    It's amazing how long some of this hardware lasts and that people still want to and are able use it after so many years.

    It's interesting how FF sticks at the consumer level have died out.
     
  7. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    That is why I like CH Products since the product lasts a long time and they support their products for a long time. :)

    Maybe something like the Butt Kicker might be easier to work with.

    http://www.thebuttkicker.com/simulation-kit
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Kicka** name. :cool: A subwoofer strapped to your seat might be a cheap DIY substitute. All gamers need one (or more) of these.
     
  9. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    You can always get the custom installs if you want better results. :)


    http://www.thebuttkicker.com/commercial-installations

    .... I really like this one myself .... this is what @Steve-Tack needs for his space game. :D

    >>>>>>
    The Kennedy Space Center Visitor Complex, has two ButtKicker-equipped exhibits, including a 270-person standing platform which simulates a space shuttle launch... and four, 40-seat flight simulators, featuring 180 full-sized ButtKicker LFE units... one unit mounted to each seat, with twenty additional units mounted to the flooring beneath each seating section.
    <<<<<<
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Lol! Bill Gates's home gaming theater.
     
  11. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I had this monstrosity from Logitech:
    https://images-na.ssl-images-amazon.com/images/I/81HCD9GF7TL.gif

    There were a surprising number of games that supported that. Some Need for Speed game rumbled when you went over wooden bridges, a Star Wars pod racing game I think did something, X-Wing Alliance had weapon effects, and of course the stomping feet of mechs in MechWarrior (I want to say MechWarrior 2 and 3).
     
    guavaman likes this.
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Wow, that's a monster. I'll admit, it was a very cool feeling using an FF joystick and quite a different experience from vibration. Maybe they'll come back in style some day.
     
  13. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    That sounds like a nice joystick. Did your joystick die or did you no longer have any support for it with more modern operating systems?
     
    Last edited: May 17, 2017
  14. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    For those with Saitek controllers Logitech has updated their site with updated software for those products. Most of the flight controllers are covered.

    Use this URL and click on the controllers section

    http://support.logitech.com/en_us/category/gaming

    If your flight controller (or other saitek controller) is older and no longer being sold such as a Saitek X-55 flight controller you can get drivers from the Saitek FTP site.

    ftp://ftp.saitek.com/pub/software/full/
     
    Last edited: May 17, 2017
    guavaman likes this.
  15. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I gave it away. At the time, it seemed like the whole idea of a "joystick" was obsolete. It's funny, though, I bought X-Wing: Alliance recently on GOG and it would have been cool to use it with that, but yeah, I have no idea if it would work on Windows 10.
     
  16. Doghelmer

    Doghelmer

    Joined:
    Aug 30, 2014
    Posts:
    120
    A quick question: Where on the PC are the key binding settings being stored after the user saves them?
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    That depends on what system you are using to save them. I'm assuming you're talking about Control Mapper which is only an optional component of Rewired. You can save the data wherever and however you choose. Even with Control Mapper you can change how the data is saved. The documentation on Control Mapper's saving is here: http://guavaman.com/projects/rewired/docs/ControlMapper.html#saving-and-loading

    It saves by using the UserDataStore component - Docs here.

    If you're just using the default prefabs, it uses UserDataStore_PlayerPrefs: Docs here. As the name implies, it saves to PlayerPrefs.
     
  18. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Based on this Logitech article I see some of those older force feedback joysticks have drivers.

    http://support.logitech.com/en_ca/article/32425

    These force feedback joysticks have windows 8 and 10 support.

    Flight System G940 J-U0001 Yes Yes*
    Force 3D Pro J-UL19 Yes Yes*
     
  19. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    This Joystick Rehab site is really fascinating history and interesting for those with older controllers. It talks about converting the old game port to USB conversion and making your own controllers.

    https://sites.google.com/site/joystickrehab/home

    Here was a list of commercial gameport to USB converters listed on their site. There are a couple of them which look really promising for those with older controllers and work on windows10/8/7 based on other videos I have seen.

    https://sites.google.com/site/joystickrehab/itemcatal

    This "The Joystick Rehab Project - Introduction to DA15 Joysticks" youtube video (from the same site) was interesting since it talks about hardware makers started using multiple signals which required their own special drivers instead of standard operating system driver. I always wondered why there were so many controllers that did not work and that answered my question.

     
    guavaman likes this.
  20. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Flight controllers:

    VKB-Sim has new modern combat grips (MGC) in pre-production. So between the base stick price (approximately $250 to $300) plus the new MCG (approximately $99) will put the pricing closer to ThrustMaster Warthog pricing.

    General information on MCG can found here.

    https://vkbcontrollers.com/?product=vkb-sim-mcg-pro

    It is an interesting design since it has two mini-sticks on the stick itself. In addition on two of the three different MGC models the mini-sticks can be either analog or digital. The Logitech/Saitek X-56 has a single mini-stick on the main stick so it will be interesting to see what the reviews say about the MCG (with its two mini-sticks) when it is officially released.

    This comparison chart has a good picture of three different MCG variants for reference.

    https://vkbcontrollers.com/wp-content/uploads/2017/04/MCG-Announce-Final-1.jpg
     
    guavaman likes this.
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Very cool. Time to go through the storage houses and find all the old treasures. :D Many of the old sticks can be found on ebay for cheap. I bought the whole Sidewinder Pro series which were added to Rewired a while back for the developers of Overload (using this homebrew adapter), who happen to be the original team who made the Descent series. I was very excited to hear they were using Rewired as Descent 1 & 2 were two of my all time favorite PC games. The only good PC joysticks I remember owning were the Sidewinder Pro and the Sidewinder FF Pro. I always played Descent with the SW Pro because the awesome twist action was perfect for controlling the 6 DOF flight.

    I also noticed on that Grendel adapter link up there I see someone has done native FF support on the SW Pro.
     
  22. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    @guavaman
    I apologize if this is in the documentation (I've been searching through it for the past hour).
    I'm hoping you can help me understand the best approach to take if I want to have 2 players with key bindings on the keyboard. (My game also uses normal joystick setups, which all work fine right now)

    Basically my users are requesting to be able to play on the keyboard and I was wanting to allow for up to 2 players to play on the keyboard if needed. My question is, how do I best set this up? I could make 2 separate sets of "duplicated" actions, one for player 1 and player 2 but that seems wrong. Should I made 2 different keyboard layouts and assign one to player 1 and one to player 2?
     
  23. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Yes. You can see it done that way in the 8-player demo in the Examples folder. That's also one of the examples given on the Layouts page. Rewired is open-ended enough that you can do a lot of things how you want to, but that's the method I use and recommend.
     
  24. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    Perfect, thank you!
     
  25. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    I know @Vampyr_Engel had several older game port controllers https://forum.unity3d.com/threads/rewired-advanced-input-for-unity.270693/page-58#post-2991516. So that might solve his issue about being able to use his older game controllers with newer operating systems.

    What is the Overload game I have not heard of it before?
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Descent was a series of (awesome) PC games in the 90's. You fly a ship around the interior of mines inside asteroids shooting shoot lasers and missiles at robots. The main special feature of the game was the 6 degrees of freedom movement through corridors and tunnels and sometimes large open spaces. It makes for a very disorienting experience at first as you fly through a corridor where up is one particular direction and then fly through a door into a room where suddenly what you thought was up is now down. Enemies could come at you from any direction also.

    Descent on Wikipedia
    Descent - first level on You Tube

    It was the first game I ever played online (apart from BBS stuff prior).

    Overload is made by many of the same team who made Descent and Descent 2. It is very much in the same vein as those two games, so I'm sure it's awesome.
     
  27. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    @guavaman
    I'm having an issue with players using the keyboard as a controller where actions aren't being called if I have other certain action keys pressed down. In this case if I'm pressing my aim down and either aim left or right then my Fire weapon action is not registering. And it's not that it just isn't registering in my code, its not even registering in the Input Manager Prefabs debug area. But as soon as I let off the other keys, then it registers fine when I press my Fire action button. Also if I only do an action input for move right, or move down by themselves (not together) then my Fire action works fine.

    Any idea what might be wrong here?!
     
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    This is most likely the explanation of your issue:

    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#keyboard-ghosting

    If you find that no input value is returned when two or more keyboard keys are pressed at the same time, you are experiencing a hardware limitation of your particular keyboard called Keyboard Ghosting. This can affect any type of computer that uses a keyboard. This is not an issue with Rewired and there is no possible way to work around this issue in software because no signal is being sent from the keyboard.

     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Rewired 1.1.2.0 was released with a bug in the editor DLL that makes editing Custom Controller buttons and axes impossible because the properties do not show up for the element when clicked. This bug was introduced because I fixed another bug related to the same area and left a piece of code commented that shouldn't have been. To address this without having to wait for the Asset Store to approve an update, I'm issuing a patch. Instructions are included in this patch.

    Please download the patch file here:
    Unity 4.x: http://guavaman.com/rewired/files/patches/Rewired1.1.2.0p1_U4.zip
    Unity 5.x: http://guavaman.com/rewired/files/patches/Rewired1.1.2.0p1_U5.zip

    Only install this over Rewired 1.1.2.0. It will not work with any other version.
     
  30. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
  31. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    @guavaman I'm working on customizing my Control Mapper from the prefab. Is there an easy way that I could change the generator code so that It uses TextMeshPro Ugui text component rather than unity's built in Text component?
     
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    No there isn't an easy way to do that. You will have to change all the components on all the prefabs and any source code that makes use of Unity's Text component.
     
  33. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    What controller did you use when you played this game?

    Thanks for the clarification and the history. That does look like a real challenging game. I am looking forward to see how they handle the controls especially in multiple controllers per player (e.g. HOTAS [stick/throttle/pedals]) context.
     
  34. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    @guavaman
    I'm hoping you can help me understand something about conflicts in the Control Mapper.

    I have a key that is bound to the D key. I choose to replace it with the Q key. I then try to rebind it to the D key like it was originally and it says that it can't because D is already in use.... even though it is not. Is this a bug or am I not understanding something?
     
  35. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    It will never tell you there is a conflict when that binding does not exist in the same or some other Controller Map that is designated for conflict checking against that Map Category. Therefore, you must have another Controller Map in some Player that has D bound to something. Or, if you've reduced the view to only show one column, you may have two D bindings on the same Controller Map and you just can't see it.

    Conflict checking all depends on your settings in each Map Category in the Rewired Input Manager. You may have some category that isn't designated for display in Control Mapper with D bound (some UI or system map), yet you have conflict checking against this map category enabled.

    Use the Debug Information in the Rewired Input Manager inspector to look at all the loaded Keyboard Maps in all Players. You'll find the one with D mapped to something.
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    I used the Microsoft Sidewinder Pro. It was perfect for this game with the twist action allowing you to roll your ship to get yourself oriented while simultaneously turning with the stick to lock onto a target and strafe moving in any of 8 directions with the hat.

    Overload is out in early access on Steam now. It does allow you to use multiple controllers at the same time. They've got a quite different binding system since they're not using the Player-Action system at all and getting input from the controllers directly.
     
  37. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    That is great that they support multiple controllers. It is always interesting to see how they handle the binding too. Thanks again for sharing.
     
  38. biegunl

    biegunl

    Joined:
    Jun 24, 2016
    Posts:
    9
    Does anyone tried to use Rewired to support Wheel Controllers on consoles? I have G920 wheel controller and it's working fine in my Unity Editor, but on my builds the wheel is not responding.
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    The G920 is not mapped on Xbox One:
    Supported Controllers

    Xbox One support works through UnityEngine.Input and their Xbox One input class and gets the name of the device as reported by UnityEngine.Input.GetJoystickNames. The only name that is mapped is for the gamepad. If this device shows up with a different name, it will not be recognized which means no automatic mapping. Read the documentation on Unknown Controllers.

    I'd be surprised if they made this show up as a different device name since all the buttons are the same as on an Xbox One controller, but it's possible. I do not have an Xbox One dev kit so I cannot check this. I don't have the G920 either. The definition was made by a user who shared it. He only made the definition for PC.

    If you want me to add support on the Xbox One for this, I will need all the information about the device and all its button and axis mappings. Use the Rewired/DevTools/UnityJoystickElementIdentifier scene and build this to the Xbox One. Please send me all the info: Name, button mappings, and axis mappings with notation stating the starting (zero) value, the fully engaged value, and if applicable, the full opposite direction value. (I need to know zero, min, max, and whether the value needs to be inverted.) Please send this information to me privately.
     
    Last edited: May 27, 2017
  40. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    The G920 wheel is for the XBOX ONE console and PC.
    http://gaming.logitech.com/en-us/product/g920-driving-force
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
  42. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I had a question about the "Update Loop" settings in the main settings panel. If I only have "Update" selected, is it safe to poll for input in LateUpdate? I'm seeing some weird behavior that I think might be related to missing some "GetButtonUp" calls when polling in LateUpdate but I'm not sure.
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Yes. When Rewired runs its update, all values of all Actions are calculated. ButtonDown and ButtonUp events happen when the state changes from the previous frame to the current. When Update is the only update loop, Rewired won't change anything until the next Update. Values it created in Update will stay until they are overwritten in the next update. So in your case, ButtonUp is calculated at the beginning of Update and will stay true through LateUpdate until the next Update.
     
    makeshiftwings likes this.
  44. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Cool, thanks! :)
     
    guavaman likes this.
  45. vabd920

    vabd920

    Joined:
    Oct 31, 2015
    Posts:
    15
    Hello,

    I want to make my Controll Mapper. And I'm stuck with keys assignment

    When I try to replace current ActionElementMap by other one, the code actually create a new ActionElementMap.

    Here's the code:

    Code (CSharp):
    1.     private void AssignKey(int actionId, Pole pole, int aemId, ActionElementMap aem)
    2.     {
    3.         ControllerMap controllerMap=null;
    4.         foreach (var item in player.controllers.maps.GetAllMaps(ControllerType.Keyboard))
    5.         {
    6.             controllerMap = item;
    7.         }
    8.      
    9.         ElementAssignment assignment = new ElementAssignment(currentKeyCode, ModifierKeyFlags.None, actionId, pole, aemId);
    10.         assignment.type = ElementAssignmentType.KeyboardKey;
    11.  
    12.         print("aem.CheckForAssignmentConflict(assignment);  "+aem.CheckForAssignmentConflict(assignment));
    13.         controllerMap.ReplaceOrCreateElementMap(assignment);
    14.  
    15.  
    16.         Actions();
    17.  
    18.     }
     
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Then your aemId does not match the ActionElementMap you're trying to replace. You do not need to be passing in both an aemId and the ActionElementMap. There is potential for error. Get the aemId from the ActionElementMap.id. If you pass in an aemId that does not exist in the Controller Map, nothing can be replaced so a new ActionElementMap will be created.

    In addition, the way you are choosing the Controller Map is very odd and prone to error too. You're selecting the last of all Keyboard Maps found in the Player. If you have multiple Keyboard Maps, only one of them will ever have that ActionElementMap in it.

    Use Debug Information to visualize what Keyboard Maps the Player has and look at the id of the ActionElementMap you're trying to replace. Compare that to what you're passing in.

    Are you aware of the Input Mapper class? This was released in Rewired 1.1.0.0 and makes control remapping far simpler.
     
    Last edited: May 27, 2017
  47. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    236
    I need some help getting the Unity standard asset car controller working with rewired. The CarUserControl is what lets the player control the vehicle. I'm looking to set up a controller map for the controls of the vehicle.
     
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    There's documentation on how to convert scripts to use Rewired:
    Converting Scripts from UnityEngine.Input to Rewired
     
  49. aaversa

    aaversa

    Joined:
    Sep 5, 2016
    Posts:
    41
    Hey gents, I'm having an issue where the default keyboard maps are loading on top of whatever the player has bound, causing (in some cases) conflicts and overlaps. Here's a simple example of what I mean.

    1. I set the Default keyboard mapping for movement to arrow keys.
    2. Ingame, I unbind arrow keys and rebind movement to WASD using the Control Mapper.
    3. I confirm, via Debug.Log, that player prefs have been saved and that movement is correctly bound to WASD.
    4. I close the game, and reopen it.
    5. Upon reopening the game, the original arrow-key maps are bound to movement... as well as the WASD maps.

    I am not loading default maps anywhere in my code, so this appears to be something that Rewired / Control Mapper is doing on its own, and I don't know why. I have "Load Data on Start" checked, but I would have thought this would only load what the PLAYER mapped - not the DEFAULT mapping?
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,627
    Based on more information from your email, I believe this is a Layout issue. You are using a different Layout when switching to the WASD configuration. Switching between Layouts is not a feature of Control Mapper.

    The UserDataStore_PlayerPrefs component loads the data on start if you have that box checked. This is the source of the problem. UserDataStore_PlayerPrefs has some significant limitations due to the limitations of the PlayerPrefs system. The biggest flaw with PlayerPrefs is that you are unable to get a list of keys. This means there's no way to find anything that's saved unless you know the key. In the UserDataStore method that loads the XML from PlayerPrefs, it has to check all possible category ids and layout ids to find maps to load. If you've saved keyboard maps in both WASD and Default layouts, both will be loaded together into your Player. Obviously, that's not what you want to be happening.

    There are really only two solutions to be able to handle using different layouts and have this persist between runs:
    1. Make a new class based on the UserDataStore_PlayerPrefs class that only saves or loads maps in a particular Layout based on some external flags that you manage. (Player 0, keyboard, current layout = "WASD", so only load WASD maps found.) This information -- the Player's current Layout -- would also have to be saved to XML and loaded for this to be persistent.
    2. Clear the keyboard maps after UserDataStore loads them and replace them with the one in the Layout you want. To achieve this, you should disable Load Data On Start in the UserDataStore_PlayerPrefs component inspector, then call the Load method in the userDataStore yourself manually (ReInput.userDataStore.Load()), then clear and load any maps you want after that. This way you have control over the order of loading which is unpredictable otherwise due to the random order of Unity script execution.
    By the way, you should know that the player.controllers.maps.LoadMaps method does not load anything from XML (because that looks to be your intention from your email). It only loads a map from the Rewired Input Manager defaults so it will not load any mapping changes made by users. None of the methods in any Rewired class load data from XML because that's not part of the core system. Save data is handled by UserDataStore which is separate and completely customizable depending on your data storage and format needs.
     
    Last edited: May 30, 2017