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,632
    EDIT: This issue was resolved through email. It turned out Rewired's Unity input manager settings had been cleared or not installed, therefore all Unity input source platforms such as Android did not have the necessary input manger entries for Rewired to get any axis values. Running the installer again and allowing it to install the input manager entries resolved the issue.

    The original Moga Pro is not a recognized controller. See the list. Only the Moga Pro Power and Moga Hero Power are.

    The Moga Pro Power in Mode B is tested on Unity 4.3 and 5.2 with no issues. You will have to determine if this is a hardware definition issue or a mapping issue. Download the ShowRewiredInfo.zip file and install it in your project. Create a blank scene and add the prefab to the scene, add your Rewired Input Manager to the scene (copy and paste it if its not a prefab, or just add the prefab), and build it on Android. It will show all kinds of information about the attached devices, the mappings, and the values of the joystick elements. If nothing appears to be happing on the axes of the joystick elements, then you know its a hardware definition issue. The only way I can imagine this being possible is if this is a Moga Pro and not a Moga Pro Power because the Moga Pro Power is tested on Unity 4 and 5. If you have any remapping of the controller in the Moga tools, disable it. Make sure it's not in some kind of keyboard/touchscreen compatibility mode.

    I'm guessing InputManagerRewired is a wrapper class you've made as there is no such class in Rewired. You do not normally get input by finding an object in the scene. You get input by getting the Player from the static ReInput class then getting input from the Player object with Player.GetAxis().

    Did you also create a Moga Pro Power map? This will override and invalidate the Dual Analog Gamepad mapping. You should delete it if you did.

    More information required:
    What version of Unity is this?
     

    Attached Files:

    Last edited: Mar 2, 2016
  2. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Can you make any of these modes possible on the new apple tv 4?

    - 8Bitdo SNES30 / SFC30 (Wireless, Joy Mode)
    - 8Bitdo SNES30 / SFC30 (Wireless, Mode 1)
    - 8Bitdo SNES30 / SFC30 ( iCade)


    In the new 9.2 firmware there will be support for bluetooth keyboards, so I'm thinking that these - 8Bitdo SNES30 / SFC30 should be able to work in iCade mode.

    I can already recognise the controller on the apple tv, I just need to figure out the unity part.




     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Sorry. Rewired does not support iCade. It only supports MFI controllers on iOS and tvOS. Rewired uses UnityEngine.Input as the input source on these platforms and Unity only supports MFI controllers.
     
  4. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Hi, just started using Rewired and can already see how much easier it's going to make joystick support, so thanks for that.

    One quick question. I've set up a mouse map to receive mouse input, but is there an equivalent of Input.mousePosition in Rewired (to get the screen position of the mouse cursor) and how do I access it?

    Thanks!
     
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632

    Thanks! I hope you get a lot of use out of Rewired.

    ReInput.controllers.Mouse.screenPosition
     
    CunningFox146 and flashframe like this.
  6. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
  7. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    Argh! I should have waited one more day before buying the plugin: I bought it soon after having read about NES30 controllers support, only to discover that practically no joypad is supported on iOS except for MFI ones of course... The plugin is great and I seriously like it, but lack of any iOS support makes it useless for what I was trying to do (a simple VR visor + BT joypad app). Why did I miss the documentation? :-/
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    It's also on the main website and the store page -- the list of native platforms here and every mention of native support lists the platforms which are native on the website, the store page, documentation, in the slideshows, etc. Every platform is not a new native implementation. This would require an enormous amount of effort to do as Unity supports 20 build platforms currently.

    You would be better off contacting me on my website and requesting a refund than posting a message like this here in the forum. Please contact me on the website or via PM with your invoice number.

    FYI, Apple's only officially supported controllers are MFI. That's Apple's standard now. All MFI Bluetooth controllers will work. There is no such thing as general HID joystick support in iOS so it is impossible to use most HID game controllers because there is no API for it. This is Apple's doing and nothing I know of can get around this without jailbreaking. The only other option is iCade, which is basically a hack and has a lot of drawbacks because it's just treating your joystick as a keyboard -- that means no analog stick axes or triggers.
     
    Last edited: Mar 1, 2016
  9. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    I'm really sorry, I didn't mean to be harsh or offend you in any way; it's just that I have been trying to squeeze this small VR project in too little free time, but had more problems than I expected and got a bit nervous.

    No worries for the refund (it wouldn't even be fair). I already found use for Rewired in other projects of mine, non-mobile. :)
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    No problem. I wasn't offended. Sorry if it sounded like I was. I just didn't see the point.

    As for the issue, like I said, I know of no other option but iCade, which in my opinion is not worth the effort because of all its limitations and potential issues. Such is the state of gamepad support in iOS as mandated by Apple. If you know of something I don't (a way to get HID joystick data in iOS) please let me know. I'm curious to know what your alternative solution for your project is.
     
  11. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    I'm pretty new to the mobile joypad scene honestly (having always used touch input for my projects). Since this is not a commercial project, for now my solution is to scavenge for any possible iCade implementation, looks like there are a bunch on GitHub. Any four directional input will do!
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    I see. Good luck!
     
  13. Slawo

    Slawo

    Joined:
    Jan 29, 2014
    Posts:
    11
    Hi do you intend to create a github project for all the controllers profiles?
    It would be nice if we could contribute to the project with new controller profiles.

    cheers.
     
  14. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    No. Rewired's controller data is not open-source and not licensed for public sharing. You can contribute to the project by sending me the profile and I will vet it and make sure it's appropriate to be added and then do so. (There are many, many controllers which cannot be supported for automatic recognition due to bad manufacturing practice using vague product identifiers or reusing the same ones on many devices and these cannot be included.)
     
  15. pjburnhill

    pjburnhill

    Joined:
    Mar 2, 2016
    Posts:
    27
    Hey Guavaman, thanks a million for an amazing plugin and the email reply to my PlayMaker support query. I got it all working in PlayMaker and I've made joystick and keyboard mapping mirroring each other (Move Horizontal (Left, Right), Jump, Duck, etc.).

    The issue I'm having at the moment is that the Keyboard input seems to be 'slow' in de-accelerating down from full value. I.e. If I push joystick left and let go, the character stops immediately, but if I use the left arrow (which I've mapped for the same action in Rewired Editor) and let go, it de-accelerates to 0 (meaning player slowly comes to a standstill) rather than goes hard 0. Is this to do with the keyboard 'simulating' joystick which I read somewhere? What's the fix here?

    Thanks!
    PJ

    EDIT: Never mind! Just found it under 'Input Behaviours' -> Digital Axis Gravity & Sensitivity, just cranked up the numbers and keyboard input is properly responsive!
     
    Last edited: Mar 3, 2016
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Glad you found it. The documentation page that talks about that is:

    Input Behaviors - The third entry under the Concepts: (Very Important!) section in the documentation.

    --------------------

    Digital Axis Settings
    These settings allow buttons and keyboard keys to be treated like axes and return values ranging from -1 to 1 instead of just True and False as is the usual case. This allows you, for instance, to have smooth character movement when using the keyboard for movement controls. See Rewired Editor - Input Behaviors for more information about each setting.

    --------------------
     
  17. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    Hi guavaman,

    I'm still on the fence of buying rewired as I'm not 100% it will fit my needs as I won't be needing all the joystick capabilities.

    What I will be needing are virtual controllers, with e.g. left a joystick and right an action/menu knob. THis for the mobile platforms, for the Desktop machines I would instead use the Mouse (LMB and RMB) and the WASD keys.

    Will rewired fit this case?

    Thanks
     
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Rewired does not include any pre-built on-screen touch controls. You make them work with Rewired through the use of a Custom Controller and a script that sends the values of the touch screen controls you are using to Rewired so it can be mapped to an Action. Rewired is not primarily a touch-based input system and does not do any kind of gesture detection, touch-drag-and-drop, etc. If that's all you want, you're better off buying a system that specializes in mobile touch controls. There are plenty of them on the asset store.

    If there's any doubt whether or not you want to buy Rewired, download the free trial.
     
  19. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    Hi, thanks for the infos. Now I'm really unsure and have the choice between Rewired, InControl, EasyTouch 5 :)
    Thing is, I need Keyboard+Mouse for the Desktop and Touch for Mobile Devices. Seems as if only InControl provides both easily but is a little outdated.

    Btw, do you support the PS4 Controller?

    Thanks
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Supported Controllers List

    FYI, there's nothing to stop you from using Easy Touch 5 or any other touch joystick system with Rewired. You don't have to only use one single input system. That's exactly what Custom Controllers were designed for.
     
    Last edited: Mar 3, 2016
  21. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    I know, didn't find ps4 or is dual shock 4 = ps4?
    Playing with your trial cc example. Am I wright that I could easily add Keyboard Input to the Virtual Controllers and also a normal Joystick? So whatever I use as Input it will work parallel?

    Does it collide with the gesture touches from EasyTouch5?
     
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Yes. The official name for the PS4's controller is Sony DualShock 4.

    Virtual Controllers (I assume you mean on-screen joysticks) are completely separate from keyboard input. In Rewired, keyboard is one type of controller, mouse is another, joysticks are another, and Custom Controllers are the last. They all work independently of one another and have to be mapped individually and assigned to Players for use. There is detailed information on the controller system in Rewired in the documentation here. There is also information on Controller Maps here.

    Custom Controllers are simply "virtual controllers" (in a generic sense, not limited to touch joysticks) to which you provide the button and axis values through scripting. The source of these values doesn't matter. It can be from on-screen joysticks or from anything else you want.

    There is an overview video of Rewired here that shows how everything works:



    Rewired is a separate system from Easy Touch. They have completely separate code and nothing will stop the two from running in the same project. If you want to use Easy Touch's on-screen controls and have them feed values into Rewired so you can simply just call rewiredPlayer.GetAxis("Move") and have it work on keyboard, joystick, and touch joystick, your job will be to:
    1. Set up your on-screen controls in Easy Touch.
    2. Set up Rewired with Actions, Players, etc.
    3. Create a Custom Controller in Rewired that has axes and buttons that correspond to your on-screen controls.
    4. Assign that Custom Controller to a Player.
    5. Create a Custom Controller map that maps your Actions to said buttons/axes.
    6. Assign that Custom Controller map to your Player.
    7. Write a script that will pipe Easy Touch 5's joystick and button output into the Custom Controller elements you created in step 1.

    The information you need to do this is discussed here. There is an example included with Rewired showing how to make a script that will pipe input into a Custom Controller. If you are averse to programming, then I advise you do not buy Rewired. While it does work with PlayMaker and Behavior Designer for those that don't want to program, if you want to use Custom Controllers, you will have to write a script.

    If you want to use Easy Touch's gesture recognition and things like drag and drop, that would not be handled through Rewired's Custom Controllers. You would use Easy Touch directly in those cases.
     
    Last edited: Mar 3, 2016
  23. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    Ok,I think that's all the information I need and ... yes, I did unterstand, just wanted to be sure I understood correctly ;) and no, I'm not averse to programming. ;) But I'm no fan of spending more time coding than designing, doesn't this keep the assets developer alive? :)

    Please forgive me my silly questions, but I am very grateful for your patient help.
     
  24. Smolli

    Smolli

    Joined:
    Mar 12, 2014
    Posts:
    84
    Seems as if you have another nerving customer at your heels :)
     
    guavaman likes this.
  25. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    :D
     
  26. DrummerB

    DrummerB

    Joined:
    Dec 19, 2013
    Posts:
    135
    Hi, does Rewired support the Vive (and Oculus Touch) controllers? If not, is this something that you're planning to implement? Thanks.
     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Rewired does not support the Vive or Oculus Touch. Looking at the documentation here, it does not look like something that would fit well into Rewired's current system as A) it requires a special SDK B) it requires support for many non-HID-standard input types (near-touch, touch surfaces, quaternion orientation, the fact that you'll probably need to be able to read a queue of motion events to detect gestures, etc.). I wouldn't rule out supporting it at some point, but Rewired does not currently support it. (Oculus Touch isn't even available for public purchase.)
     
  28. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    iCade would be great for those 8bit do controllers , at least for the ones without analog control, I would be more than happy to be able to use those.

    I know apple wont officially support it, but thats their loss.
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Thanks for the suggestion, but I don't have any plans on adding iCade support at this time. It can lead to a lot of issues because of how it works using a hidden UIView and intercepting keyboard keys, which can cause other problems with the app when keyboard input is required and ultimately require manual switching of the system by the developer making for a less-than-seamless experience.

    If I were to do native input on iOS it would be a native MFI solution that properly supported every feature of MFI including pressure-sensitive buttons as I do on OSX.
     
  30. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Allright thanks for the detailed info, I might try it myself with the help of this VirtualGameController package.

    It is quite tricky todo for sure, As my game does not use the keyboard for anything else I might get away with having to use the hidden UIView.

    https://github.com/robreuss/VirtualGameController
    https://github.com/robreuss/VirtualGameController/wiki/iCade-Controller-Support

    I want to share this here, not to distract from your input package but to help others wanting to get an 8bitdo controller to work on apple tv.

    I hope i can get it to work :)
     
  31. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Thanks for the info. You could use Custom Controllers to bridge iCade and Rewired potentially. It would definitely be some work, especially working out how to handle multiple controllers for multiple players, but it would be possible.

    Good luck!
     
  32. S_Darkwell

    S_Darkwell

    Joined:
    Oct 20, 2013
    Posts:
    320
    Hello @guavaman, sir!

    I have both a question, and a potential (minor) bug report.

    Question: What are the potential performance considerations of the various ways of retrieving Rewired input? For instance, I presume polling is slower than adding an event delegate. Is this correct? Also, is it more performant to attach individual delegates for each action, or to assign a delegate to any action and manually determine its value, such as in your "OnInputUpdate" delegate example?

    Potential Bug Report:
    In the Rewired Editor, if you press 'Keypad Enter' while polling for a keypress, the Key is set to 'Return' instead of 'Keypad Enter'. This key can be set manually, and operates perfectly once set. The issue is strictly limited to recognizing the difference between 'Return' and 'Keypad Enter' during the polling period. I'm not certain whether this is a limitation of the system or a bug, but I figured I would point it out in the case that it helps.

    As always, thank you so much!
    - S.
     
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    There is no speed difference vs polling and events. Everything in Rewired beyond the lowest system level is currently state based, updated per-frame. Events are generated based on changes in state per frame.

    I have not measured performance, but there shouldn't be any difference. By subscribing to every input event, you're going to have to do testing on the data to determine what event happened. The same thing is happening internally.

    There's nothing I can do about this because Unity is returning KeyCode.Return for the current pressed key. Event.current.keyCode return KeyCode.Return when the keypad enter key is pressed for some reason.
     
    S_Darkwell likes this.
  34. S_Darkwell

    S_Darkwell

    Joined:
    Oct 20, 2013
    Posts:
    320
    @guavaman:

    As always, thank you so much for the prompt response!

    Regarding the Return / Keypad Enter polling, I had suspected that it might be as such. I was only pointing it out in the case that my suspicion was incorrect.

    Thank you again! Be well!
    - S.
     
  35. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    No problem!

    I suspect multiple key events may be sent for that key. The only thing is, I wouldn't be able to know which key event to ignore so I can't really filter out Return.
     
    S_Darkwell likes this.
  36. Slawo

    Slawo

    Joined:
    Jan 29, 2014
    Posts:
    11
    Can I use Rewired in a project for the PS4 and XboxOne or will I have to roll my own solution for those platforms?
     
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    The list of supported platforms is on the website and in the documentation:
    http://guavaman.com/projects/rewired/#TestedPlatforms

    Yes, Xbox One and PS4 will work.
     
  38. Deleted User

    Deleted User

    Guest

    Since this question is specific to Rewired, I felt like I would not get much value by posting a new thread on the forums, so I decided to try it here.

    I am working on a multiplayer light gun game, and I am using the ArcadeGuns G-500 AimTrak Light Guns. My light guns are wired up, and they are responding to trigger and movement (x and y) events; however, the guns seem to have parameter limitations set (-1,1) for the movement on both the x and y axis. Basically, I am only able to shoot on a fraction of the game screen. I have been messing around with the settings for a few days and cannot figure out where the problem lies. I am certain it is not my script that is the problem, but I will provide the only script that I have anyways below:

    Code (CSharp):
    1. using System.Collections;
    2. using Rewired;
    3.  
    4. [RequireComponent(typeof(CharacterController))]
    5. public class MyCharacter : MonoBehaviour {
    6.  
    7.     public int playerId = 0; // The Rewired player id of this character
    8.  
    9.     public float moveSpeed = 3.0f;
    10.     public float bulletSpeed = 15.0f;
    11.     public GameObject bulletPrefab;
    12.  
    13.     private Player player; // The Rewired Player
    14.     private Vector3 moveVector;
    15.     private bool fire;
    16.  
    17.     void Awake() {
    18.         // Get the Rewired Player object for this player and keep it for the duration of the character's lifetime
    19.         player = ReInput.players.GetPlayer(playerId);
    20.     }
    21.  
    22.     void Update () {
    23.         GetInput();
    24.         ProcessInput();
    25.     }
    26.  
    27.     private void GetInput() {
    28.         // Get the input from the Rewired Player. All controllers that the Player owns will contribute, so it doesn't matter
    29.         // whether the input is coming from a joystick, the keyboard, mouse, or a custom controller.
    30.  
    31.         moveVector.x = player.GetAxis("MoveHorizontal"); // get input by name or action id
    32.         moveVector.y = player.GetAxis("MoveVertical");
    33.         //Debug.Log(moveVector);
    34.         fire = player.GetButtonDown("Fire");
    35.     }
    36.  
    37.     private void ProcessInput() {
    38.  
    39.         // Process fire
    40.         if(fire) {
    41.             GameObject bullet = (GameObject)Instantiate(bulletPrefab, moveVector, transform.rotation);
    42.         }
    43.     }
    44. }
    I am thinking that I am missing something somewhere, but I am not sure where as I am very new to this API still. Any help would be greatly appreciated, thanks.
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Please see the documentation on how to set up AimTrack G-500:
    http://guavaman.com/projects/rewired/docs/HowTos.html#configuring-arcadeguns-g500

    This is also linked from the Supported Controllers page underneath the G500's entry.

    You must set the G500 to joystick mode instead of absolute position mode for them to work with Rewired.
     
  40. Deleted User

    Deleted User

    Guest

    Thanks for answering. I have followed the documentation for setting up AimTrack G-500. The trigger and movements work, and I am getting the desired results; however, the movements seems to be restricted to (-1,1) on both axes.
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    That sounds correct for joystick mode. Joysticks should not return values > +/- 1. Have you calibrated the guns using the AimTrack software?

    View the raw data returned by the guns by using the Rewired/DevTools/JoystickElementIdentifier prefab.

    1. Create a new scene.
    2. Create an empty Rewired Input Manager.
    3. Add JoystickElementIdentifier to the scene at 0,0,0.
    4. Press Play.
    5. Watch the data returned.

    What range of data do you see?
     
  42. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    @iProdigy
    Input axes always return a value between -1 and 1. You are using that value to set your moveVector position absolutely. Instead, you need to add position over time using the Joystick input.

    For example:

    Code (CSharp):
    1.  moveVector.x += player.GetAxis("MoveHorizontal"); // get input by name or action id
    2. moveVector.y += player.GetAxis("MoveVertical");
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    The AimTrack doesn't work like a joystick axis in any way except that it returns -1 to 1 values relative to the position the gun is pointing on the screen within the calibration area. It returns absolute screen position in a range of -1 to 1. It shouldn't be accumulated.

    Actually, I didn't even look at the code. It looks like it's just copied and pasted from one of my examples with the character movement removed. I hadn't considered this could be the issue, but after looking at it, the problem lies here:

    Code (csharp):
    1. GameObject bullet = (GameObject)Instantiate(bulletPrefab, moveVector, transform.rotation);
    @iProdigy: You're trying to use the "move vector" (gun axis position) as a spawning position of your bullet as if the lightgun axis is returning a world-space position, which it is not. If you do that, you're only going to spawn bullets within a tiny 1-unit square around the 0,0 point of your world. You need to transform the joystick axis coordinate value to a world-space position to use it like you're trying to.

    It's been a while since I worked with them, but I seem to recall the AimTrack uses 0,0 as the center of the screen. So when the light gun is perfectly centered, it should return 0,0. When you're fully pointed to the right side, you should receive 1,0, left side = -1, 0, upper right corner would be 1, 1, etc. This is essentially a screen-space position offset so that 0,0 at the center instead of the lower-left corner and scaled to return an absolute range of 2 units instead of 1. This is different from Unity's screen-space coordinate system in that 0,0 is lower-left in that system with values in a 0-1 range.

    You can find a world--space position for your spawn point by transforming from "Aimtrack-space" to Unity screen-space then to world-space, then spawn your bullet. The Camera class has various methods for transforming points.
     
    Last edited: Mar 8, 2016
  44. knotFF

    knotFF

    Joined:
    Apr 13, 2013
    Posts:
    66
    Hello.
    I am getting a little lag on my controller (PS4 on OSX via bluetooth) on the LOOK stick.
    It seems to play fairly well on the mouse/keyboard, but not so much on the controller, specially when switching directions (left/right). The lag is small but noticeable.
    I have an almost empty scene, with a plane and a simple uFPS setup (minimum) and Rewired.
    (my dev partner says performance is ok on Windows.. with a wired controller)
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Lag can be from any number of factors. It's extremely doubtful it is related to Rewired, especially since you say it works fine with the keyboard/mouse and on Windows.

    The most common source of lag is hardware -- the Bluetooth receiver and/or controller. I get terrible lag from Bluetooth devices on my test machine because of the Bluetooth dongle I use. It will stop detecting controller input when you move more than a few feet away from the source. This is purely hardware related and cannot be fixed in software. The DS4 does tend to be laggier than many controllers I've tested, with input latency spiking as high as 160ms at times (can be measured with some DS4 tools on Windows.) Again, I'm this can be attributed to BT hardware issues.

    Rewired updates every frame, so the higher the framerate, the faster input will update. Rewired's input update is only dependent on two factors:
    1. Unity's current framerate (because input is refreshed at the beginning of every update cycle). Lower frame rates will lead to increased lag in controls because the input may already be somewhat old by the time the frame is drawn if there is a lot of heavy processing going on that makes the frame take many ms to pass.
    2. The rate of input updates being sent by OSX.
    Neither of these are controllable by Rewired.

    Other sources of lag can be in your code if you're doing any smoothing of values, etc., or in physics depending on what/how you're moving.
     
    Last edited: Mar 8, 2016
  46. knotFF

    knotFF

    Joined:
    Apr 13, 2013
    Posts:
    66
    Thanks once again for the prompt reply!
    You are right. It looks like a hardware issue. Since posting the message above, I had a little break and recharged the controller.
    Now with the controller fully charged the performance seems to be very close to the mouse/keyboard.
    Thanks once again!
     
    S_Darkwell likes this.
  47. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    Hey, I didn't find it in the documentation, but I somehow remember that rewired caches internal stuff for better performance. Does it generate substantial overhead if I have one controller map for cars with X = drive and one controller map for planes with X = fly propulsion and both maps always activated or should I deactivate the unused maps, even if the actions have different names?
    The benefit from "always on" would be, that my menu exit code don't have to be aware of whatever I was doing before, flying or driving
     
  48. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,632
    Each controller map that is enabled must be evaluated every frame. So yes, it will reduce performance to leave a bunch of unnecessary controller maps enabled. Practically speaking, it's probably not going to be measurable until you have a lot of Actions mappings that are just sitting there doing nothing. If you've got an 8-player game and dozens of Actions per player that are sitting there not being used, then definitely disable the controller maps. It's also more efficient when you disable maps that contain Actions that aren't on any other maps because those Actions are disabled entirely for that Player. But I advise only worrying about optimization if you really need to. The input system is far from the heaviest component of a game. Caching doesn't apply here.
     
  49. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    Ah, okay. Thank you.
     
  50. VoidFish

    VoidFish

    Joined:
    Nov 27, 2012
    Posts:
    31
    Hello,

    First thank you for an awesome asset! I've found it awesome to work with.

    I have having a few problems however. On my machine if I unplug or plug in a controller once the game has started (in either editor or build) the input for my entire system hangs and I have to hard reset my PC. I'm on Windows 10 and using an Xbox One controller.

    Also since I've incorporated Rewired into my build one of my beta testers is reporting a crash to desktop whenever he has a gamepad plugged in.

    I'm using Unity 5.3.3f1 and the latest version of Rewired.

    I've attached some screenshots of my settings.

    Any ideas? Any more information that I could provide you?
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      47.2 KB
      Views:
      930
    • 2.PNG
      2.PNG
      File size:
      47.3 KB
      Views:
      893
    • 3.PNG
      3.PNG
      File size:
      35.8 KB
      Views:
      790
    • 4.PNG
      4.PNG
      File size:
      75.6 KB
      Views:
      770