Search Unity

Rewired - Advanced Input for Unity

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

  1. sschoener

    sschoener

    Joined:
    Aug 18, 2014
    Posts:
    73
    Hi there,

    I just bought Rewired yesterday and it already saved me a lot of work :) Thanks!
    What I have noticed is that build times and the time between hitting play and actually getting the game to start have skyrocketed since I added Rewired (Unity 2017.1, relatively small project). Are there any best practices w.r.t. to Rewired on how to reduce these times?
     
  2. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    Build times should not be affected. Rewired is almost entirely DLLs. DLLs are pre-compiled. They don't add any time to the build process (except in the case of IL2CPP platforms because IL2CPP must convert them to c++ like every script). There are only a handful of other scripts in the project. The only time build times are increased is the first time you import Rewired or when you update Rewired DLLs. This is because Unity's API updater checking all the DLLs for obsolete code. This process is extremely slow.

    The delay when pressing Play in the editor however is unavoidable. There's nothing that you or I can to do reduce this time short of removing controller definitions. It's 100% due to Unity's serialization system. All the controller definitions have to be deserialized when you press Play each time. This is what Unity does with all serizalized data stored in all Components in the scene when you press Play. The Unity editor is very slow at desrializing data, adding 1-4 seconds to Play launch time depending on the system speed. The build is not and runs almost instantly. The only possible solution to eliminate this would be to completely rewrite the data storage system and all editors to not rely on Unity's GameObject data serialization system and replace it with something else that's faster. This is infeasible for several reasons -- 1) It would require completely rewriting and replacing all editor tools. This includes not only the editor tools, but also all UI components from UnityEngine.Editor would have to be re-written because they all rely on Unity's serialization system. Even Undo/Redo relies on it. 2) Any controller definitions anyone has made up to this point would no longer work and would have to be converted to the new system. There just is no good solution to this issue. Had I known the serialization system was so slow in the editor when I started writing Rewired, I would never have used it.
     
    Last edited: Aug 26, 2017
  3. CommanderBrace

    CommanderBrace

    Joined:
    Aug 26, 2017
    Posts:
    2
    I'm very seriously considering buying your plugin for my final school project. I've run into the issue where button presses that occur faster than a frame on Joysticks aren't registered at all when I lock my target framerate to 60fps. I don't expect framerates dropping below 60 for Update(), but I also need a solution that will capture joystick button down and joystick button up events should they occur in the space between input updates. Is Rewired capable of detecting and retaining that information between polling intervals?

    For example let's say I have a 10 frame buffer that captures a history of the last frame a particular action's down event occurred. If some inhuman beast brushed their attack input and it registered both the press and release right after I checked for inputs last frame and right before inputs were checked for the next frame, would Rewired have a way of giving me whether or not those events occurred between my checks in Update()?
     
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    Rewired will not miss input received between frames unless the platform and input source in question relies on UnityEngine.Input and it doesn't capture them. (OSX and Linux rely on UnityEngine.Input for keyboard input, and Android and iOS always rely on it as well as a few other platforms.) I haven't explicitly tested UnityEngine.Input's keyboard behavior at low frame rates on OSX or Linux. I do know that it does capture input between frames on Windows, but Rewired defaults to native keyboard input on Windows anyway. Unity also does not miss joystick input as far as I have tested, but it is possible it does miss it on Xbox controllers because they use XInput and XInput is inherently a polling-based API. If XInput is polled on the main thread, you're guaranteed to miss some presses at very low frame rates. Rewired's XInput implementation is multi-threaded.

    Rewired won't give you access to the input history though. The best way to test Rewired's features is to try the free trial.
     
  5. CommanderBrace

    CommanderBrace

    Joined:
    Aug 26, 2017
    Posts:
    2
    Thank you. I was using an xbox controller for testing and was checking both Input.GetButtonDown and Input.GetButtonUp, and I did have problems with missing a few face button downs whenever it was done quickly. As long as joystick input won't be missed in Rewired, then this looks like the best option for my purposes. I can code the buffer system separately.
     
  6. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    611
  7. kscarlett

    kscarlett

    Joined:
    Jan 5, 2015
    Posts:
    3
    Hey,

    I tried googling for this, but I couldn't find a solution.
    Is there any way to create a Joystick/Keyboard map where one button points to two different actions (in two different categories)? I'd want to have my UI confirmation button to be the same as my jump button, but I don't want to map them to the same action so players can map them to separate keys if they want to.
     
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    It's not really that complicated. You just create an implementation that maps game actions to Rewired actions and call player.GetXXX(action) -- standard Rewired usage.

    I've attached a complete example including modified versions of the classes/interfaces from the previous post. This also includes a touch input manager interface so touch input can be modular as well. Instructions are included. The Rewired implementation has a few extra features such as user-definable platform-dependent touch controls and auto touch control hiding when a joystick is connected.
     

    Attached Files:

    Selzier likes this.
  9. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    Google isn't really the right resource to use for getting help on Rewired. The documentation contains everything you need to know: http://guavaman.com/rewired/docs
    There really aren't any resources out there on using Rewired except the documentation and this thread.

    See the Rewired Standalone Input Module documentation:
    http://guavaman.com/projects/rewired/docs/RewiredStandaloneInputModule.html

    The section near the start entitled "Rewired Actions."

    In short, use a different Controller Map in a different Map Category for UI controls.

    If you are using Control Mapper or Input Mapper with conflict checking enabled, you will have to exclude conflict checking on the UI category against your game/default categories and vice versa so you don't get conflicts reported when remapping these buttons. See the Map Categories page of the Rewired Input Manager for conflict checking options. There is also information on conflict checking in the Control Mapper documentation.
     
    Last edited: Aug 27, 2017
  10. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    The Unity asset store seems a bit slow this week. I am surprised the Rewired update is not in the store already.
     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    Me too. :(
     
  12. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    806
    Maybe this was too obvious for me, but maybe something like this could be beneficial for new users:

    Code (csharp):
    1. using UnityEngine;
    2. using Rewired;
    3. using UnityEngine.Events;
    4.  
    5. public class RewiredEventTrigger : MonoBehaviour {
    6.     public RewiredEventAction[] Actions;
    7.     private Player p;
    8.     void Start () {
    9.        p = ReInput.players.GetPlayer(0);
    10.     }
    11.     void Update () {
    12.         foreach (RewiredAction a in Actions) {
    13.             if (a.rewiredActionID >= 0) {
    14.                 if (p.GetButton (a.rewiredActionID)) {
    15.                     a.eventMethod.Invoke ();
    16.                 }
    17.             }
    18.         }
    19.     }
    20. }
    21.  
    22. [System.Serializable]
    23. public struct RewiredEventAction {
    24.     [ActionIdProperty(typeof(RewiredConsts.Action))]
    25.     public int rewiredActionID;
    26.     public UnityEvent eventMethod;
    27. }
    28.  
     
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    I have in the past begun working on a complete input event component system that supports all event types, but quit when I realized I'm essentially duplicating everything PlayMaker and Behavior Designer do better.
     
  14. dearamy

    dearamy

    Joined:
    Mar 17, 2015
    Posts:
    68
    Is there any way to set a CustomController as a field in the inspector and get a list of all custom controllers maybe?
     
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    No. A Custom Controller is not a serializable object that inherits from UnityEngine.Object and cannot be assigned in the inspector. The only Custom Controller that can be selected in any inspector is in the Touch Controller and that's only because the inspector editor was built to support that.

    Depending on your use case you may be able to make an inspector to do it.

    All methods for directly reading serialized data from the Rewired Input Manager like getting a list of all Custom Controller types requires using undocumented methods. Otherwise, you can export some information about Custom Controllers from the export consts tool. Getting a list of instantiated runtime Custom Controllers is done through the ReInput.ControllerHelper class, but that's not the same thing as getting a list of Custom Controller types which would be required in an inspector because you're not dealing with instantiated runtime objects. You would also have to instantiate that Custom Controller and assign it to a Player for it to be used for anything.
     
    Last edited: Sep 1, 2017
  16. janiche

    janiche

    Joined:
    Jan 4, 2015
    Posts:
    35
    I have a weird mal function of Rewired standalone input module, for some reason when I press a UI button works as I pressed another axis. (ex: press UP works as Left).
    And I had assigned all UI axis correctly. Can someone help me?
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    The only way this can happen is if you assigned the wrong axis in the Controller Map or have transposed the "Horizontal Axis" and "Vertical Axis" Actions in the RewiredStandaloneInputModule inspector. There's no other way. If you are using Control Mapper or some other UserDataStore_PlayerPrefs implementation, see this important warning:
    http://guavaman.com/projects/rewired/docs/ControlMapper.html#clear-xml-data
     
  18. janiche

    janiche

    Joined:
    Jan 4, 2015
    Posts:
    35
    I assigned the right axis, and still working wrong.

    (I'm not using any control mapping)

    Captura de pantalla 2017-09-01 a la(s) 22.38.19.png Captura de pantalla 2017-09-01 a la(s) 22.36.36.png
     
  19. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    Your first picture shows you've mapped the directions wrong. Up/Down Arrow should be UIVertical but they're mapped to UIHorizontal and the opposite with Left/Right Arrow.

    View attachment 245220
     
  20. janiche

    janiche

    Joined:
    Jan 4, 2015
    Posts:
    35
    I feel so stupid, tnx I saw it a lot of times, but I cant see it, again I'm feeling so stupid right now
     
  21. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,741
    I am trying to figure out why I have a memory leak at the very start of my game app, before the game is even started. At the Main Menu.

    Other than having a Rewired Input Manager, I don't have much going on in the scene. A camera, gui to click "Start Game", and EventSystem.

    Whenever I disable the "Rewired Input Manager", the memory leak is resolved. The application stays around 110mb of ram in Task Manager. Whenever I enable Rewired Input Manager, the memory leak goes on for infinity. about 5MB/s increase.

    I created an empty scene with nothing in it but a Rewired Input Manager, removed all other scenes from the build, and the memory leak is still there.

    Unity 2017.1.0f3 (64 bit Windows)
    Latest version of Rewired: 1.1.5.3

    I'll create a new empty project & test if the latest version of Rewired still does this.

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

    Update: Recreate Memory Leak

    1. New Project
    2. Import Rewired
    3. Rewired--> Create-->Input Manager
    4. Save Scene, Add to Build, Build
    5. Play (Memory Leaks to infinity)
     
    Last edited: Sep 4, 2017
  22. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    5MB/s sounds absurd. Nothing in Rewired comes anywhere close to using that much memory.

    I've tested every setting I can think of that might affect this and cannot reproduce this at all in the editor or in builds:
    • Unity 4.6.0
    • Unity 5.6.3f1
    • Unity 2017.1
    • 32-bit / 64-bit
    • Normal build / Debug build
    • Run in background yes / no
    Zero leaking.
    • How are you monitoring this memory usage?
    • What devices are attached to the system? Including Bluetooth devices and virtual devices.
    • Anything in the log?
    • Any other usual settings in your Player settings?
    • Disable each one at a time and test: Use XInput, Native Mouse Handling, Native Keyboard Handling, Enhanced Device Support.
     
    Last edited: Sep 4, 2017
    CarterG81 likes this.
  23. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,741
    Answers in bold:


    Changed "Primary Input Source" to the following and it stopped:

    • Unity
    • SDL2
    • XInput (with & without native mouse/keyboard handling)
    • DirectInput
    It seems to only occur when RawInput is selected. All the other options don't effect anything (XInput, Native Handling, Enhanced Device Support, etc.)


    In the build's output_log.txt, there is only one difference between a working (DirectInput) vs memleak (RawInput), which I set in BOLD

     
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    @CarterG81
    • Did you test this in the editor?
    • What does the Unity profiler say? GC alloc?
    • When using Direct Input with Native Mouse Handling or XInput with Native Mouse Handling, the exact same Raw Input manager is being used for the mouse as is used for everything in Raw Input mode.
     
  25. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,741
    I tried on my surface pro (windows 10) and there is no issue. It is only on my two gaming desktops.

    Since I use my main desktop for both gamedev & gaming, I have used a virtual controller before... I thought I removed it awhile back but maybe it is still around. I will see if that is the culprit. I bet it is. I didnt have this issue before playing marvel heroes ;)

    Following this guide, installing vJoy (the version from their link) and I bet that is the culprit.

    https://forums.marvelheroes.com/discussion/318444/guide-target-lock-for-keyboards-wasd-movement-too

    Checking...
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    Thanks for the link. I'm testing on 3 more systems now (1 VM). So far I see no issues. I know others have used VJoy with Rewired with no issue. I will try installing VJoy and setting it up as described in that link.
     
  27. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,741
    Yep, that was my culprit.

    On my machine, it caused a 5MB/s leak. On my wife's machine, it caused a 1GB/s or so leak (Empty project immediately started at 6GB & skyrocketed to 11GB and counting). I thought I had removed vJoy, but I saw it there in hardware manager. I uninstalled it & voila! No more leak with RawInput.

    Headsoft's VJoy is different from (I think) the more popular VJoy. However, it was the only thing which would work for us to get that marvel heroes fix.
     
  28. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    Amazing... Okay, I'll set it up and see if I can find a workaround. I'll let you know when I do.
     
    CarterG81 likes this.
  29. CarterG81

    CarterG81

    Joined:
    Jul 25, 2013
    Posts:
    1,741
    Thank you & thanks for helping me figure out so quickly how to fix it. You rock!
     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    Hi,

    I've fixed the issue and will include this in the 1.1.7.0 update. 1.1.6.0 is still awaiting approval from the Unity Asset Store (been in review since 8/24), so it won't be in the next update on the Asset Store.

    Glad to help. Thanks for reporting this so users of Headsoft VJoy won't have issues with games that use Rewired!
     
    CarterG81 likes this.
  31. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    Dialogue System for Unity was submitted about the same time and it is already approved on 8/25/2017. Pro Logic Nodes 1.2 was submitted on 8/24/2017 and it was approved 8/29/2017. Not sure why Rewired is taking this long on the asset store review. Maybe the asset store needs to be pinged.
     
  32. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    I'll send them an email and see what's up.
     
  33. Situacao

    Situacao

    Joined:
    Dec 4, 2013
    Posts:
    21
    Hey guavaman!

    I've been using XInput in my project and it's been working great. However, I'm implementing a feature on my UI where the game recognizes the controller being used and displays the help buttons accordingly. As I've seen from the Known Issues in the docs, this isn't exactly possible due to XInput's base implementation. However, at the same time, I need XInput's feature of recognizing the L and R triggers separately.

    Is there any way I can make this all work? Is it possible to not make DirectInput group the two triggers?

    Thanks in advance!
     
    MikeM1970 likes this.
  34. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,926
    Hey, just wondered if it's possible to query buttons outside of play mode. It would just be used for simple tool vis and is not essential nor a request :)
     
  35. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    The only limitation with XInput is that it cannot tell the difference between different XInput controller types. You can certainly display glyphs, but all would be for the Xbox 360 Controller, not different for Xbox One controller for example.

    No. It's not possible. This was done by design by Microsoft and is done by their HID driver.
     
    Last edited: Sep 7, 2017
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    No it's not. Rewired is completely idle outside of Play mode. It doesn't do anything until Awake is called at runtime at which point it initializes everything including all the native input sources. The entire system from top to bottom including native input objects would have to be serialized in order for this to be done (or at least to be able to transition from edit mode to Play mode without having to reset everything). The vast majority of Rewired's structure is not serializable for a lot of reasons (many delegates, events, object references that do not inherit from UnityEngine.Object, etc.). In addition, it would greatly complicate the process of modifying controller maps, players, and all other editor-definable objects because these would either have to become live or the system would have to be reset every time you make a change. I've thought about adding editor execution before, but the enormous effort doesn't seem to be worth the payoff.
     
    Last edited: Sep 7, 2017
    hippocoder likes this.
  37. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    Unity support says they're still working through a long list of submissions and will get to it as soon as they can.
     
  38. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Hi @guavaman, I've got a pretty strange question.

    Just for fun, I'm looking into creating a simple custom game controller, essentially just a Pong style paddle. The Teensy micro-controller boards seem to be oriented toward doing USB HID devices, so I ordered one and should be getting it later today.

    Out of curiosity, is there a way in Unity and/or Rewired to do HID *output*? I know Rewired can do rumble on Xbox and DS4, and control the light bar on a DualShock 4, but I assume that's controller-specific stuff done outside of the HID interface.

    Since I'll be playing with a one-off controller, there's no particular need for output to it to go through HID. I was just wondering if that was a thing. I don't know a ton about Teensy or Arduino type stuff, but my assumption is that if I can't do that, I could instead do serial communication to it via USB in Unity and just have the board check for commands that way. I could use the output for something like an LED that could be set by a custom game that only works with that controller.
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    Rewired doesn't expose anything at that low a level. It does communicate with DS4 via HID, but has to use XInput for Xbox controllers as Microsoft's HID driver for those devices does not include support for vibration. Sending messages to HID devices is done through output reports. You'd need to communicate directly with the OS's HID API to do this. You can use a cross-platform HID library like hidapi to avoid the headaches of having to come up with an abstraction for every platform, but you will have to make a c# wrapper for it. I'm not sure if there are any good C# HID libraries.
     
  40. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Interesting, thanks! I didn't expect to hear that the special DS4 stuff goes through HID.

    On a side note, I did get my custom paddle controller to work in a Rewired-powered test project. It's noticeably jittery when at rest, but it's nicely responsive at least. It took a few tries to get the Rewired input mapper to recognize the right axis, but it worked! It even showed my custom device name.
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    As long as it shows up as a HID joystick (usage page 1, usage 4) or a HID gamepad (usage page 1, usage 5), Rewired will expose it. If it uses any of the axes in usage page 1, buttons in usage page 9, and some other special ones in a few other usage pages, they will work as well.

    You can make a controller definition for it if you want it to be automatically recognized. You'll probably want a zero deadzone for that and the unknown controller defaults to 0.1 on all axes. You can also designate the axis to be a delta value and non-calibrated.

    Rewired doesn't do any axis filtering like jitter smoothing, but you could do it on the axis afterwards. I suppose I could add something, but I'd need to figure out what algorithms and settings to offer.

    As for detecting the axis with Control Mapper, it has a fixed range an axis must change over polling time to bind it. I don't know what values your device is returning, but I imagine deltas. If it's returning very tiny amounts per frame like 0.01, it would take quite a lot of rotation to get it to meet the threshold (0.3 or 0.5 or something).
     
  42. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,459
    Hope the unity asset store can get to it soon. By the way I just noticed Rewired has 491 ratings and 150 reviews which is pretty amazing. Congrats for all your hard work on Rewired!

    @Steve-Tack

    That is wonderful to have a custom paddle controller. There are not many options for paddle controllers currently so it makes it more interesting.

    Have you tried it with some of the breakout assets in the store yet? This one looks really inexpensive and with full source code.

    https://www.assetstore.unity3d.com/en/#!/content/5763
     
    guavaman likes this.
  43. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Yes, exactly. I ended up just setting the dead zone to zero with the UI. I don't know if I'll bother with a controller definition as long as the remapping works well enough. What does non-calibrated do?

    The delta thing sounds interesting. Is that like more of a mouse control type of thing? I was considering having a mode on the controller that could emulate a mouse X-axis instead, but I know that would need to work differently that an absolute axis value.

    There's some logic out there that does averaging and some other tricks, but I'm not sure they'd be appropriate for game controls. You need game controllers to be pretty responsive, and some of those techniques slow things down.

    Turns out the jittery thing was more of an electronics issue. After some more Googling, it turns out that putting the right size capacitor between the right pins smooths it right out. It also didn't help that my temporary test version had alligator clips close to each other and longer wiring than I'll have in the final version. I think I was getting interference from that stuff too. My first thought is always a software solution, but this time that wasn't the way to go. :)

    The way it works is that I send a 10-bit integer value through the HID interface for the main X-axis 60 times a second. It isn't a delta, it's the absolute position coming from the analog input at that time. The X-axis value is 0-1023, with 0 all the way to the right, 512 as the middle, and 1023 all the way to the left. I was turning it plenty to get the axis to get recognized, so I'm not sure why it took several tries. Doesn't matter much, as possibly the only Unity project I'll ever use it with has it saved in the user prefs now.
     
  44. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Well, it took me just a few minutes to get a paddle sprite and controller going for an initial test. I was thinking more of making a Space Invaders type of game anyway. Who wants to bounce a ball around when you can SHOOT SPACE ALIENS?
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    It just doesn't apply any calibration, clamping, or scaling and lets the raw value through.

    Yes. I was thinking it was a spinner for some reason, not a paddle controller. A spinner would definitely need to return a relative value since it can spin forever (like a mouse can move in any direction forever) and a -1 to +1 value wouldn't make sense.

    Interesting. That's good to know. I know some games like flight sims do have axis noise reduction / smoothing settings, but I haven't looked into the issue.

    The way the detection routine works, when polling starts, it takes the current value as the reference value and then watches for a change in value of I believe 0.5f (if an absolute coordinate axis) over the polling time in either direction. If you start polling while your axis is at 0.6, you've only got a 0.4 positive range left so you'll never be able to hit the threshold in that direction.

    Sounds like a fun project. I'd like to try creating a custom HID device at some point. But who's got time?
     
  46. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I was originally going to try to do an endless spinner control (Tempest, etc), but it sounded trickier, so I went with the easier option of just a paddle with a fixed position.

    If you ever do, the Teensy boards seem particularly well suited to that. As you might imagine from the name, they are super tiny, so they should be able to fit into just about anything.

    The electronics and programming of the hardware was super easy. The micro-controller code for sending the X-axis value is literally:

    Joystick.X(value);

    I'll end up spending quite a bit more time designing the enclosure than doing the electronics part of it. It's as much an excuse to do something with 3D printing as anything.
     
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    I have heard of it. It does sound like it could be used to make almost anything. But they definitely took all the fun out of programming for it. :D
     
  48. djgriff

    djgriff

    Joined:
    May 29, 2014
    Posts:
    263
    Hello, I have followed the quick start and done exactly as stated but doesnt work..
    Do you have any sample code that works so i can see how this assets works as i am currently getting no input through
    I have created the input map and it doesn't have any impact. I also created the class as described but that didnt seem to work either.. so i skimmered down the code to add the input to the position of the transform and still nomthing.. just wondering why its not working. Could any one supply an example of how to move a cube with rewired.

    Thanks
     
  49. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    3,884
    There are many examples included with Rewired. Look in the Rewired/Examples folder. EightPlayers is the most appropriate for basics.

    See the Troubleshooting page for step by step guides on things to check:
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html

    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#joystick-problems
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#keyboard-problems
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#mouse-problems
    http://guavaman.com/projects/rewired/docs/Troubleshooting.html#debug-information
     
  50. djgriff

    djgriff

    Joined:
    May 29, 2014
    Posts:
    263
    thanks for the reference.. so how do i assign the keyboard to the player? do you have a code snippet?

    The really odd thing is the buttons work, but there is no Axis data coming through.. Even created a new project and clean install to make sure im not doing or having anything interfere with the asset

    thanks

    Code:
    https://imgur.com/a/498UA

    Map and assignment:
    https://imgur.com/a/Eb4DM
    https://imgur.com/a/87MjT
     
    Last edited: Sep 12, 2017