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,633
    Shoulder 1 is the "bumper" and shoulder 2 is the "trigger" position. This is the same naming convention as the Gamepad Template: http://guavaman.com/projects/rewired/docs/ControllerTemplates.html#gamepad-template
     
    Last edited: Jun 23, 2018
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    It's not clear to me whether you're talking about a physical joystick or a touch joystick. If the latter, are you using the Rewired touch controls or something else?

    What sensitivity setting did you change in the Input Behavior?

    Or are you saying this?:
    1. You have an on-screen touchpad to control look.
    2. You are using a physical joystick to also control look.
    3. The touchpad and the physical joystick have different sensitivity when applying the look.

    If that's what you're saying, are you handling the input differently depending on whether the value is absolute or relative? Joysticks return absolute values, touchpads/mice return relative (delta) values. The code has to be aware of this or you're going to have issues. http://guavaman.com/projects/rewire...load_Rewired_Player_GetAxisCoordinateMode.htm
     
  3. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Sorry, i should have been more specific in my question. I have a touchpad for regular iOS mode but a Physical joystick ( Nimbus MFI im using for testing) if users want to.

    I tried to play with Input Behavior Joystick Axis Sensitivity & Custom Controller Axis Sensitivity but i understand I can't really and I'll have to modify with some code right ?

    EDIT : in my camera move section I solved it this way. Don't know if it's the optimal way of doing it. :

    if (playerController.controllers.GetLastActiveController().type == ControllerType.Joystick) {
    // increase sensitivity for joystick mode

    } else {
    // normal sensitivity of the touchpad when in iOS touch mode

    }
     
    Last edited: Jun 23, 2018
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I'm still not clear on two things:
    1. Is this "touchpad" a Rewired touch control Touchpad?
    2. Are you using the same code to process the values from both the touchpad and the physical joystick axis?

    If #2, then that's your problem. As I stated before, touchpads act like a mouse and returns a pixel delta value (unless, of course, this is a Rewired touch control Touchpad where you can set the value format it returns.) Pixel delta values are not equivalent to absolute -1 to +1 values returned every frame by a joystick axis. For example, delta values should never be multiplied by Time.deltaTime while absolute values must be. This is the same thing that would happen if you were to use Input.GetAxis("MouseX") and Input.GetAxis("Horizontal") (from a joystick) and try to use the same code on both.

    As for Input Behavior sensitivity, you need to understand what they do:
    Joystick axis sensitivity is multiplied by the joystick axis value and the result is clamped from -1 to +1.
    Custom Controller axis sensitivity is multiplied by the custom controller axis value and the result may or may not be clamped depending on the Coordinate Mode setting of that particular Custom Controller axis. In this case, if you've set it up correctly, the Custom Controller axis for the touchpad would be set to Relative coordinate mode because it's returning a pixel delta value and Calibrate would be set to False.

    You joystick axis being clamped to +/- 1 will never be large enough to match what you're getting back from a touchpad as a pixel delta because it's clamped. A pixel delta can return values > 10, even >100 depending on the frame rate and how fast you are swiping.

    Setting Custom Controller axis sensitivity to something tiny like 0.05 might be enough to make it seem like the joystick and touch pad values are close enough, but then you'll still have a problem when you multiply the result by Time.deltaTime which will cause the touch pad speed to vary based on the frame rate. In addition, Custom Controller axis sensitivity will be applied to all Custom Controller axes so if you have other axes of other kinds, they will be affect by this sensitivity setting as well.

    Code (csharp):
    1. if(player.GetAxisCoordinateMode(actionId) == AxisCoordinateMode.Absolute) {
    2.     // treat as a joystick
    3. } else {
    4.     // treat as a mouse/touchpad pixel delta
    5. }
     
    Last edited: Jun 23, 2018
  5. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    thx @guavaman I'll rework it that way :)

    I'll tell you again, you have the best product support have seen on the Asset Store !!
     
  6. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Thanks! I don't have time to do much else. :eek:

    I'm thinking about adding a GetAxisRelative or similar function which will return all axes in relative terms so the same could could potentially be used for relative and absolute axes. This value would be premultiplied by Time.unscaledDeltaTime for absolute axis values.
     
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I have a preliminary implementation of Run in Edit Mode done. If you'd like to try a beta for testing, contact me here.
     
  8. danbrani

    danbrani

    Joined:
    Nov 22, 2012
    Posts:
    46
    Done.
     
  9. ahmed_decoy

    ahmed_decoy

    Joined:
    May 19, 2013
    Posts:
    58
    Thanks for feedback how to debug.

    So it looks like the issue is Auto-Assign Joysticks is not working for me on the PS4 Dev Kit. The current configuration I have works fine for PC, Mac, and Xbox One Dev kit.

    The Joystick is detected and I have my Player mappings set up just fine it seems. In the debug code provided, I added a line to assign the detected joystick to a Player.

    p.controllers.AddController(ControllerType.Joystick, 0, true);

    Worked just fine. The controller was successfully added to the player and the gamepad functioned correctly.

    To focus on auto-assign, I tried plugging in a second controller. 2nd Joystick is recognized but no auto assignment. When unplugging the first assigned joystick, it was successfully unassigned from the player. Kept plugging gamepads in and out and no auto assign worked.

    Not sure what I'm doing wrong, works just fine on other platforms. Seems like all functions are working besides auto assign which my current implementation depends on. Is there any breakpoints/debug code I can use to focus on what might be going wrong with auto-assignment? I suppose worst case scenario, I can handle auto assignment manually but would like to know of options to avoid developing my own system for that.

    upload_2018-6-24_13-5-40.png

    Thanks!
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    You have "Assign Joysticks by PS4 Joy Id" enabled on PS4. This keeps the Rewired Player Id aligned with the Unity joystick id. If you plug in a joystick and it is assigned to the 3rd PS4 player, it will be assigned to Rewired Player 2 (0-based index). The only way this could possibly fail is if the joystick is showing up as some Unity joystick id other than 1-4.

    If you have assigned the joystick manually to another Player previously such as the System Player, joystick auto-assignment will not re-assign it. Make sure you don't have some script somewhere turning off joystick auto-assignment at runtime as well.

    Contact me here about this issue instead of discussing it on this forum because PS4-related issues should not be discussed in public.
     
  11. Michael-Ryan

    Michael-Ryan

    Joined:
    Apr 10, 2009
    Posts:
    184
  12. ahmed_decoy

    ahmed_decoy

    Joined:
    May 19, 2013
    Posts:
    58
    Unchecking the "Assign Joysticks by PS4 Joy Id" fixed it.

    If I have any more issues I'll contact you directly, Thanks!
     
  13. Poopaloop

    Poopaloop

    Joined:
    Aug 1, 2013
    Posts:
    21
    Hi, I'm trying out the 'SimpleControlRemapping' scene. I notice you can't access control to the buttons with the Joystick automatically. You have to click on a button via the mouse for joystick control to kick in. Is there a way to change this? So mouse input is not needed?

    Thanks
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    This is a Unity UI usage issue, and while not related to Rewired, it's addressed in the RewiredStandaloneInputModule documentation because of how often it is asked:
    http://guavaman.com/projects/rewire...troubleshooting-joystick-keyboard-doesnt-work

    Problem: Unity UI navigation with joystick or keyboard doesn't work

    While this is a general Unity UI usage issue and not a Rewired issue in any way, because I've received so many support requests where this ends up being the answer, I've decided to post it here.
    • Unity UI cannot be controlled by keyboard or joystick unless you specify a current or starting Selectable GameObject in the Unity UI EventSystem.
    Unity UI requires a Selectable to be selected before any navigation will work for joystick or keyboard, otherwise it has no starting point from which to navigate when you press a key or a stick direction. You must either set the First Selected field in the inspector of the EventSystem component, or set the current selected GameObject via scripting as shown below.

    Code (csharp):
    1. using UnityEngine.EventSystems;
    2.  
    3. void SetSelected(GameObject selectableObject) {
    4.    // Set the currently selected GameObject
    5.    EventSystem.current.SetSelectedGameObject(selectableObject);
    6. }
    Please refer to the Unity documentation for information on how to use Unity UI.
     
  15. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    Hey, really loving the plugin so far, can the Player class be renamed to something else?
     
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    No. That is not possible. It would break every single project made with Rewired.

    I'm guessing you're asking this because you have some class in your game named Player also and you are getting compiler errors because it's getting confused. It would be impossible to name all classes in a plugin to things that can't possibly conflict with other classes in your project. That's the whole point of namespaces -- to allow you to use member names that make sense without regard to other members in the project. This is just simple C# namespace management.

    If you need to access both the Rewired.Player and your (probably global) Player class in a script, write the full class name instead:

    Code (csharp):
    1. Rewired.Player player; // the Rewired Player class
    2. Player player; // your global Player class
    If you add a using Rewired statement at the top of the script, you do not have to type out the Rewired. part, but a global Player class will take precedence over Rewired's Player class and it won't use Rewired's. In this case, type Rewired.Player.

    If you want to force the Rewired.Player to be used in a script, add the using statement after the namespace declaration (if there is one):

    Code (csharp):
    1. namespace MyNamespace {
    2.     using Rewired; // this will cause Rewired.Player to take precedence over the global::Player class on all code within the namespace declaration.
    3. }
    You can also declare an alias for a specific class:

    Code (csharp):
    1. using P = Rewired.Player; // now P is an alias for Rewired.Player in this script
    2.  
    3. ...
    4.  
    5. void SomeMethod() {
    6.     P player = ReInput.players.GetPlayer(0);
    7. }
    8.  
    You can also access a global Player class by using the global keyword:

    Code (csharp):
    1. global::Player player; // your global Player class
    There are countless ways to work with namespaces in C#. I suggest you read the documentation on them.
     
    Khena_B likes this.
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    I found the source of the issue. It only occurs if you have set Player.isPlaying to false on a Player. There is an inverted boolean check of the Assign Joysticks to Playing Players Only option in Joystick Auto-Assignment. This only affects PS4 joystick assignment. If your Player.isPlaying is false and Assign Joysticks to Playing Players Only == true, it will incorrectly not assign that joystick to that Player. This will be fixed in the next update.
     
    ahmed_decoy likes this.
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Rewired 1.1.16.0 is available for download for registered users. If you'd like to receive early access to updates, please contact me here. The update will be available on the Unity Asset Store when they approve it.

    Please see Updating Rewired before updating.

    Release Notes:

    1.1.16.0:

    Changes:
    - Added "Run in Edit Mode" option to allow Rewired to run outside of Play mode in the Unity editor.
    - Added "Allow Input in Editor Scene Views" option to Rewired Input Manager settings.
    - Added workaround to System.Diagnostics.Stopwatch bug on Xbox One platform.
    - Added Absolute to Relative Axis Sensitivty option to Input Behavior.
    - Keyboard and mouse input now works when the Unity editor window is not in focus and "Ignore Input When Application Not In Focus" is disabled.
    - Added support for 3Dconnexion Space Navigator on Windows Raw Input, Windows Direct Input, OSX Native, and Linux Native.

    API Changes:
    - Added InputManager_Base.runInEditMode property.
    - Added InputManager_Base.isRunningInEditMode property.

    New Controller Definitions:
    - 3Dconnexion Space Navigator

    Bug Fixes:
    - Unity 2018.1+, Windows Standalone, Exclusive Full Screen window mode, Raw Input / Direct Input + Native Mouse Handling - Chaging certain QualitySetings properties at runtime no longer causes mouse to stop working.
    - Control Mapper, Unity 5.2+: Input field vertical scroll bar now auto-hides properly.
    - Unity 2018.2.0x-ImprovedPrefabs: Fixed exception thrown by the Rewired Input Manager inspector.
    - Joystick Auto-Assignment now works properly when "Assign Joysticks to Playing Players Only" is disabled with "Assign Joysticks by PS4 Joy Id" enabled and a Joystick should be assigned to a non-playing Player.
     
  19. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    I'd like to use the button down buffer so that on low fps inputs aren't missed, the issue is that if I jump for example, the jump stays pressed down for the buffer duration even if the key is released which is not what I want, I want the buffer to be "consumed" as soon at the action gets through, is there a way around that, I tried looking for a method to clear a specific action but couldn't find any, thanks
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    That's not what Button Down Buffer is for:

    http://guavaman.com/projects/rewired/docs/InputBehaviors.html

    Button Down Buffer

    This makes player.GetButtonDown return TRUE for extra time beyond a single frame. See Rewired Editor - Input Behaviors for more information.

    -----------

    I realize the name may not be the most appropriate for its function.

    Rewired will not miss button presses at low frame rates, but there will be a point where hammering in rapid succession at a frame rate lower than the pressing rate will prevent "button down" events from occurring and instead it will just register continually on. You cannot avoid this because Actions "button down" state are calculated based on the previous and current state of the value of the contributing input sources and therefore it cannot return a "button down" event two consecutive frames in a row.
     
    Last edited: Jun 27, 2018
  21. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    I understand what the buffer does, being able to attack after dodging even if the key was pressed slightly too early for example Is also something I want for my game, I just got Rewired so i'm not familiar with it, but with Unity's default solution inputs were often missed at a low framerate.

    In either cases, the action would stay TRUE for too long in some situations, can't the buffer be "cleared" in some way?

    Here's an example situation: I want a buffer so that even if jump was pressed slightly too early after an attack it would stay true for a few frames and not miss it, but on the same frame as jump is called it should go back to false so that GetButtonUp can be called and the jump can be canceled, from what I've tested I have to wait for the buffer duration to cancel the jump.

    Also I have another question, I'd like to use all the axis as buttons and have them activate at 50% press only, I've seen the button dead zone option but I'm not sure how to use the axis as buttons

    Thanks
     
    Last edited: Jun 27, 2018
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    There is no way to negate an Action's down events or clear the button down buffer. The buffer is just a timer that times out when it expires.

    The intended usage is:
    If GetButtonDown == true and Action is allowed, do the Action
    The buffer timeout should be short enough that it would expire during any Action that would be performed
    This assumes that the Action cannot be immediately interrupted again by another GetButtonDown on the next frame. If that is the case, the button down buffer will not work for your use case.

    While I can see the usefulness of being able to clear the buffer manually, this isn't possible right now for a variety of functional reasons. Rewired also does not have any kind of "consume" concept for any input event. In the design of Rewired, permission of whether an input event that is received should actually be used is expected to be tracked and handled in the scripts, not that the script clear the event itself to prevent other scripts from receiving it.

    GetButtonUp will return True when the button is released even while GetButtonDown continues returning True because of the button down buffer. You do not need to wait for GetButtonDown to stop returning true before checking GetButtonUp. Once you initiate your Jump Action, stop checking GetButtonDown and start watching for GetButtonUp. Either that or just watch GetButton instead to watch the held state.

    Button Dead Zone is the Axis value threshold required to activate the "button" state. You call player.GetButton and player.GetNegativeButton. That's it. Button presses are explained in the documentation here.
     
    Last edited: Jun 27, 2018
    Khena_B likes this.
  23. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    I'm not sure I understand, for example I have a "Horizontal" axis action, It's set up to work with D-pad, keyboard and left joystick, but I want the left joystick to behave like the D-pad and return -1,0 and 1 with a 50% deadzone before it activates

    In Unity I would set up an axis called "Horizontal" with a "Dead" of 0.5, then use Sign on that value so that it would only return -1,0 or 1.

    Are you suggesting that I set up the left joystick as a left and right button instead, and use a "Button Dead Zone" of 0.5?

    Thanks
     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    You don't have to change the way you set up the Action in any way. All Actions can be queried as buttons (digital) or axes ("analog").

    You can't prevent the left joystick from returning the full range of floating-point values if you are querying with GetAxis because GetAxis by definition returns the full range of values. If you only want digital values, you use GetButton. GetAxis is used to get a full-floating point value from an Action. GetButton is used to get a digital value. That's why GetNegativeButton exists. GetButton gets the positive digital value and GetNegativeButton gets the negative digital value.

    Code (csharp):
    1. if(player.GetButton("Horizontal")) {
    2.     // the positive direction is pressed
    3. } else if(player.GetNegativeButton("Horizontal")) {
    4.     // the negative direction is pressed
    5. }
    If you want to read this as a floating point value, convert it in your script.

    Code (csharp):
    1. float horizontal = player.GetButton("Horizontal") ? 1f : player.GetNegativeButton("Horizontal") ? -1f : 0f;
    When reading an Action's button value with GetButton, if the underlying input source is actually an axis, Button Dead Zone will be used to determine when the button state activates.
     
    Khena_B likes this.
  25. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    Yeah I just figured it out, still getting used to the changes, I'll use the logic you posted to get an int out of it.

    Thanks!
     
  26. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    Lastly, I don't have a lot of experience with coding, what would be the easiest way to access the player from any scripts without having to get a reference each time?

    I created a static class and made a reference in the constructor, it works but I'm wondering if this makes any sense as it's the first time i'm using a static class.

    Code (CSharp):
    1. using UnityEngine;
    2. using Rewired;
    3.  
    4. public static class PlayerInput{
    5.  
    6.     public static Player player;
    7.  
    8.     static PlayerInput()
    9.     {
    10.         player = ReInput.players.GetPlayer(0);
    11.     }
    12. }
     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    That is not safe. Rewired is not initialized until the Rewired Input Manager MonoBehavior has Awake called on it by Unity. Your Player object will always be null if any member of PlayerInput is ever called by any code before Rewired initializes because the static constructor will be called at that time.

    The documentation covers how to get a Player and shows you the standard pattern:
    http://guavaman.com/projects/rewired/docs/HowTos.html#get-player

    If you let Unity continue playing while recompiling scripts, you will have to follow this pattern instead:
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#null-reference-during-recompile
     
    Khena_B likes this.
  28. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    I'm aware of the standard pattern but I'm trying to avoid using the namespace and have to declare and reference a variable in each scripts, I guess i'm used to just type Input.Getbutton, is there no way to set this up other than using a singleton and have the script's priority set to after Rewired?

    Thanks
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    You don't have to get and store the Rewired Player. Your scripts can just as easily call ReInput.players.GetPlayer(0) every time they need the Player object. There's almost no overhead in doing that.

    If you don't want to use a singleton, the only safe way is to get the Rewired Player on demand in your static class:

    Code (csharp):
    1. public static InputManager {
    2.     private static Rewired.Player _player;
    3.     public static Rewired.Player player { get { return _player ?? (_player = ReInput.players.GetPlayer(0)); } }
    4. }
    There is no need to set script priority on a singleton. Rewired's script execution order is already set to -32000. All scripts will execute after it does if the MonoBehaviours exist in the scene at run time.

    Depending on what functionality you need, you could also just make your input manager wrap whatever functions you need from Rewired and leave write your scripts without any knowledge of Rewired whatsoever:

    Code (csharp):
    1. public static InputManager {
    2.     public bool GetButton(int playerId, int actionId) {
    3.         if(!ReInput.isReady) return false;
    4.         return ReInput.players.GetPlayer(playerId).GetButton(actionId);
    5.     }
    6. }
    7.  
    8. public class MyScript : MonoBehaviour {
    9.     void Update() {
    10.         if(InputManager.GetButton(0, ActionIds.Fire)) {
    11.             // do something
    12.         }
    13.     }
    14. }
     
    Khena_B likes this.
  30. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    Thanks, I'll figure it out from here, I appreciate the support
     
  31. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    Is there something comparable to Input.ResetInputAxes, I used this to clear the input right after closing a menu for example, so that the player wouldn't perform any actions after pressing the button
     
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    No. You cannot clear Action values. Action values are calculated from the combination of all contributing input sources to that Action, whether physical or virtual. All Action values are calculated at the beginning of the frame and cannot be changed in the middle of the frame. There are many technical reasons why allowing clearing Action values in this system would cause a tremendous number of issues.

    Your example of closing a menu can be handled in many ways. Here are a few:
    • Block input processing for a fixed amount of time after transitioning back to game mode.
    • Using GetButtonUp to close the menu instead of GetButtonDown.
    • Enable and disable Controller Maps when switching modes. Disabling the Controller Maps in the "Gameplay" category for example while the menu is open, then re-enabling them when the menu is closed will cause the "Gameplay" Actions to return no "down" events until the next time a button is activated.
     
    Khena_B likes this.
  33. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    I'm trying to figure out if there is a way to know which gamepad was used, GetLastActiveController() doesn't really go into details, my goal is to switch between Xbox and PS4 icons depending on which controller was used, is there a way to check for specific gamepads?
     
  34. Michael-Ryan

    Michael-Ryan

    Joined:
    Apr 10, 2009
    Posts:
    184
    I see the mouse position can be accessed with ReInput.controllers.Mouse.screenPosition, but the property only has a getter. Is there any way to set the screen position?
     
  35. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    If you are using Xinput then no. I am quoting a small section from the documentation that follows ...

    https://guavaman.com/projects/rewired/docs/KnownIssues.html#xinput-device-name

    On Windows, with Use XInput enabled, and always on Windows App Store and Windows 10 Universal builds, there's no way to differentiate one XInput controller type from another. To XInput, everything is simply Gamepad with an id of 0-3. This is not a Rewired issue, it is a design decision by Microsoft.
     
    Last edited: Jun 28, 2018
  36. Poopaloop

    Poopaloop

    Joined:
    Aug 1, 2013
    Posts:
    21
    Much appreciated. Now creating a script to make my menus all work together nicely with Rewired.
    Again, much thanks for the response and for the awesome asset.
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Khena_B likes this.
  38. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    DS4 is not an XInput-compatible controller. Rewired can tell the difference between Xbox controllers and DS4 on Windows even with XInput enabled. It cannot tell the difference between an Xbox 360 controller and an Xbox One controller however on Windows with XInput enabled.
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
  40. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    @longroadhwy told you why this is the case in his message above.

    From the documentation:

    Controller Maps:
    Special Considerations for XInput gamepads on Windows Standalone, Windows App Store, and Windows 10 Universal

    This is also in Known Issues:
    Windows Platforms: All XInput devices use the Xbox 360 Controller map when "Use XInput" is enabled

    Also noted in How To's -
    Identifying recognized Joysticks.
     
    Last edited: Jun 28, 2018
    Khena_B likes this.
  42. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Rewired 1.1.16.1 is now available for registered users. If you'd like to receive early access to updates, please contact me here.

    Please see Updating Rewired before updating.

    Release Notes:

    1.1.16.1:

    New Controller Defintions:
    - 3Dconnexion KMJ Emulator

    Bug Fixes:
    - Windows Standalone, Direct Input: Fixed major bug introduced in 1.1.16.0 that caused most joysticks to stop working when using Direct Input as the primary input source.
    - Saitek X52: Removed duplicate "Trigger (Stage 2)" element identifier.
    - Saitek X52 Pro: Removed duplicate "Trigger (Stage 2)" element identifier.
    - MadCatz CYBORG V1: Removed duplicate "Button 2" element identifier.
    - VKB Sim Gladiator MKII: Renamed misnamed duplicate "MODE2 SHIFT POV Hat Up Left" to "SHIFT POV Hat Up Left".
    - Logitech Driving Force GT: Removed duplicate "Brake" element identifier, removed duplicate "Return" element identifier.
     
  44. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    If I am not mistaken mode 2 gives you a different value for the POV Hat values then in Mode1. It is not like CH FighterStick where mode is a different state and but the HAT values remain the same.
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    That's correct, but one of the elements was misnamed. It was actually not a Mode 2 element. The definition had 2 elements with exact same the Mode 2 name and one of them was really Mode 1.
     
  46. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Rewired 1.1.16.1 is now available on the asset store.
     
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    Awesome! Because I was just about to upload 1.1.17.0. :p

    Available for registered users to download now. Contact me here to register.

    Please see Updating Rewired before updating.

    1.1.17.0:

    Changes
    - Windows Standalone + Direct Input, Linux Standalone + Native: Added support for 3Dconnexion Space Navigator for Notebooks and 3Dconnexion Space Explorer.
    - Added 6 DoF Controller Template.

    New Controller Defintions:
    - 3Dconnexion Space Explorer
    - 3Dconnexion SpaceMouse Module
    - 3Dconnexion SpacePilot Pro

    API Changes:
    - Added ISixDofControllerTemplate interface.
    - Added SixDofControllerTemplate class.
    - Added ControllerTemplateElementType.Stick6D value.

    Modified Controller Definitions:
    - 3Dconnexion Space Navigator: Added matching information for 3Dconnexion Space Navigator for Notebooks.
     
  48. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    That 6 DoF Controller Template sounds very interesting. Have to read the docs to learn more about it.
     
  49. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,633
    The docs don't really go into much detail. It's just another template that applies to a controller that has a way to move in 3 axes and rotate in 3 axes. The initial use case is for 3Dconnextion 3D mice. So if you're playing a 6 DoF game like Overload, you'd be able to set up your controls so you can move and rotate in all directions using the SpaceNavigator for instance. You could also use it like any other joystick. It probably has some possibilities in flight games also.
     
  50. Situacao

    Situacao

    Joined:
    Dec 4, 2013
    Posts:
    21
    Hey guavaman! I've been using Rewired for a while now, but after updating to the latest version, I've been having two issues that I didn't have before.

    The first one is related to when I start my game. As the game is starting, I have a GameLauncher class that properly launches the game and handles all of its settings. This includes assigning a MainPlayer variable for Rewired on a separate singleton (I'm just getting the Player at index 0 here, basically). This GameLauncher class does this on its Awake, at the time 200 of the ScriptExecutionOrder. After this, on the Press Any Key prompt of the title screen, I then poll for any key pressed on any connected controller and assign that controller (using AddController) to the MainPlayer. It's here that lies my problem. Before the update, I was having no problem doing this, but on this version, the controller isn't being added to the player, as it is shown in Rewired's Debug Info panel. However, if I print the controller name by script it is shown correctly there. What's even more strange is that if I assign the MainPlayer variable just before pressing the key on the controller everything works fine. Any reason why this is happening?

    The second one is related to disabling all input during the game. Until now, I've been disabling the Rewired Input Manager gameObject whenever I wanted to disable input (for example, during screen transitions). However, this now produces an error every time I try to do stuff (for example, changing the Controller Maps) while the Manager is disabled. What's the best way to disable all input since all of this doesn't work anymore?

    I'm using Unity 5.6.5p1. Thanks in advance!
     
    Last edited: Jul 4, 2018