Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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,501
    Rewired 1.1.0.0 is now available for registered users to download on the website immediately. If you'd like to register to receive early access to updates, please contact me here. The Unity Asset Store should get the update in 5-10 business days.

    As always:

    It's been just over 2 months since Rewired's last update, so this one is pretty big.

    The most notable new features:
    1. Touch Controls: On-screen touch and tilt controls for mobile platforms. (Unity 5.0+)
    2. Input Mapper: Allows for much easier control remapping from scripting.
    3. Action Element Maps can now be individually enabled and disabled.
    4. Controllers can now be enabled and disabled.
    5. A number of new examples are included.
    6. Some great new flight controllers!
    7. A lot more. (See release notes below.)

    TouchControls.jpg


    Release Notes:

    1.1.0.0:

    Changes:
    - Added Touch Controls: Touch Controller, Touch Joystick, Touch Button, Touch Pad, Touch Region. (Requires Unity 5.0+, 5.3+ for optimal results.)
    - Added Tilt Control. (Requires Unity 5.0+.)
    - Added Input Mapper system for easier input mapping.
    - The Keyboard can now be assigned and removed from Players like the Mouse using the Player.controllers.hasKeyboard property.
    - Controllers can be enabled and disabled using the Controller.enabled property. Disabled Controllers will not produce any input.
    - Action Element Maps can now be enabled and disabled using the ActionElementMap.enabled property.
    - Windows Standalone: Added XInput as a primary input source option.
    - Windows Standalone, Raw Input: Joysticks now return input when the application is not in focus. (Requires "Ignore Input When App Not In Focus" option to be disabled).
    - Added "Exclude from Polling" option to buttons in Hardware Joystick Maps.
    - Added ability to export Players and Custom Controllers to constants.
    - Android: "Support Unknown Gamepads" option is now enabled by default.
    - Replaced event system for events in order to better handle exceptions thrown by event listeners and issues caused by failure to unsubscribe from events and then destroying the GameObject of the subscriber. Exceptions thrown by event listeners will no longer stop events from being sent to the remaining listeners.
    - Polling now returns an element identifier id for keyboard keys.
    - Replacing an existing Action Element Map in a Controller Map no longer creates a new Action Element Map and instead reuses the existing one.
    - Updated Debug Information to include new changes and display more information.
    - Added DevTools/DebugInformation tool for use in debugging builds.
    - Added DevTools/JoystickElementIdentifier scene.
    - Added DevTools/UnityJoystickElementIdentifier scene.
    - Added Press Start To Join example.
    - Added Press Any Button To Join example.
    - Added Touch Controls 1 example.
    - Added Touch Buttons 1 example.
    - Added Touch Joysticks 1 example.
    - Added Simple Control Remapping example.
    - Changed Control Remapping 1 example to use Mapping Listener and User Data Store.
    - Control Mapper is now an optional install offered during setup.

    New Controller Definitions:
    - Saitek X-56 Rhino Stick
    - Saitek X-56 Rhino Throttle
    - CH Products FlightStick Pro
    - CH Products CombatStick
    - Thrustmaster T.Flight Hotas 4
    - Thrustmaster T.Flight Stick X
    - Oculus Touch - Left (Unity input only)
    - Oculus Touch - Right (Unity input only)
    - Oculus Remote (Unity input only)
    - OpenVR Controller - Left (Unity input only)
    - OpenVR Controller - Right (Unity input only)

    Modified Controller Definitions:
    - Logitech G29: Added optional Logitech G Driving Force Shifter mappings.
    - SteelSeries Stratus XL HID (Android/Win): Windows Raw Input, Direct Input, Fallback: Added mappings to support device with latest firmware and SteelSeries Engine installed.

    Controller Template Changes:
    - Added Left Pedal, Right Pedal, and Slide Pedals to HOTAS Template.
    - Added Left Pedal, Right Pedal, and Slide Pedals to Thrustmaster TWCS Throttle Template map.

    API Changes:
    - Added ReInput.ControllerHelper.DestroyCustomController method.
    - Added InputActionEventData.GetAxisDelta method.
    - Added InputActionEventData.GetAxisRawDelta method.
    - Added Controller.enabled property.
    - Added Controller.Elements property.
    - Added Controller.elementCount property.
    - Added Controller.GetElementIdentifierById method.
    - Added Keyboard.GetKeyCodeByButtonIndex method.
    - Added Keyboard.GetKeyCodeById method.
    - Added Keyboard.GetButtonIndexByKeyCode method.
    - Added Keyboard.GetElementIdentifierByKeyCode method.
    - Added Keyboard.GetKeyName(KeyCode key, ModifierKeyFlags flags) method overload.
    - Added Mouse.screenPositionPrev property.
    - Added Mouse.screenPositionDelta property.
    - Added CustomController.ClearAxisValue method.
    - Added CustomController.ClearAxisValueById method.
    - Added CustomController.ClearButtonValue method.
    - Added CustomController.ClearButtonValueById method.
    - Added ActionElementMap.enabled property.
    - Added ActionElementMap.controllerMap property.
    - Added ActionElementMap.ShowInField method.
    - Added AxisCalibration.applyRangeCalibration public setter.
    - Added InputActionEventType.ButtonRepeating enum value.
    - Added InputActionEventType.NegativeButtonRepeating enum value.
    - Added InputActionEventData.GetButtonRepeating method.
    - Added InputActionEventData.GetNegativeButtonRepeating method.
    - Added Player.GetAxisDelta method.
    - Added Player.GetAxisRawDelta method.
    - Added Player.GetButtonRepeating method.
    - Added Player.GetNegativeButtonRepeating method.
    - Added Player.ControllerHelper.hasKeyboard property.
    - Added Player.ControllerHelper.MapHelper.GetFirstButtonMapWithAction(ControllerType controllerType, int controllerId, int actionId, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.GetFirstButtonMapWithAction(ControllerType controllerType, int controllerId, string actionName, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.ButtonMapsWithAction(ControllerType controllerType, int controllerId, int actionId, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.ButtonMapsWithAction(ControllerType controllerType, int controllerId, string actionName, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.GetFirstAxisMapWithAction(ControllerType controllerType, int controllerId, int actionId, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.GetFirstAxisMapWithAction(ControllerType controllerType, int controllerId, string actionName, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.AxisMapsWithAction(ControllerType controllerType, int controllerId, int actionId, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.AxisMapsWithAction(ControllerType controllerType, int controllerId, string actionName, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.GetFirstElementMapWithAction(ControllerType controllerType, int controllerId, int actionId, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.GetFirstElementMapWithAction(ControllerType controllerType, int controllerId, string actionName, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.ElementMapsWithAction(ControllerType controllerType, int controllerId, int actionId, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.ElementMapsWithAction(ControllerType controllerType, int controllerId, string actionName, bool skipDisabledMaps) overload.
    - Added Player.ControllerHelper.MapHelper.GetFirstMapInCategory(Controller controller, string categoryName) method overload.
    - Added Player.ControllerHelper.MapHelper.GetFirstMapInCategory(Controller controller, int categoryId) method overload.
    - Added Player.ControllerHelper.MapHelper.GetMap(int mapId) method overload.
    - Added Player.ControllerHelper.MapHelper.GetMap(Controller controller, int mapId) method overload.
    - Added Player.ControllerHelper.MapHelper.GetMap(Controller controller, int categoryId, int layoutId) method overload.
    - Added Player.ControllerHelper.MapHelper.GetMap(Controller controller, string categoryName, string layoutName) method overload.
    - Added Player.ControllerHelper.MapHelper.GetMaps(Controller controller) method overload.
    - Added Player.ControllerHelper.MapHelper.SetAllMapsEnabled(bool state, Controller controller)
    - Added Player.ControllerHelper.MapHelper.SetAllMapsEnabled(bool state, ControllerType controllerType, int controllerId)
    - Added Player.ControllerHelper.MapHelper.SetMapsEnabled(bool state, Controller controller, int categoryId)
    - Added Player.ControllerHelper.MapHelper.SetMapsEnabled(bool state, Controller controller, int categoryId, int layoutId)
    - Added Player.ControllerHelper.MapHelper.SetMapsEnabled(bool state, Controller controller, string categoryName)
    - Added Player.ControllerHelper.MapHelper.SetMapsEnabled(bool state, Controller controller, string categoryName, string layoutName)
    - Added Player.ControllerHelper.MapHelper.GetMapsInCategory method.
    - Added Player.ControllerHelper.MapHelper.ClearMapsInCategory method.
    - Added Player.ControllerHelper.MapHelper.ClearMapsInLayout method.
    - Added Player.ControllerHelper.MapHelper.ClearMapsForController method.
    - Added Player.ControllerHelper.MapHelper.ClearMapsForControllerInLayout method.
    - Added Player.ControllerHelper.ConflictCheckingHelper.DisableElementAssignmentConflicts method.
    - Added ControllerMap.DisableElementAssignmentConflicts method.
    - Added ControllerMap.GetFirstButtonMapMatch method.
    - Added ControllerMap.GetFirstElementMapMatch method.
    - Added ControllerMap.ForEachButtonMapMatch method.
    - Added ControllerMap.ForEachElementMapMatch method.
    - Added ControllerMap.ForEachElementAssignmentConflict method.
    - Added ControllerMap.SetAllButtonMapsEnabled method.
    - Added ControllerMap.SetAllElementMapsEnabled method.
    - Added ControllerMap.DisableElementAssignmentConflicts method.
    - Added ControllerMap.ContainsElementIdentifier method.
    - Added ControllerMap.ContainsKeyboardKey method.
    - Added ControllerMap.DoesElementAssignmentConflict(ControllerMap controllerMap, bool skipDisabledMaps) method overload.
    - Added ControllerMap.DoesElementAssignmentConflict(ActionElementMap actionElementMap, bool skipDisabledMaps) method overload.
    - Added ControllerMap.DoesElementAssignmentConflict(ElementAssignmentConflictCheck conflictCheck, bool skipDisabledMaps) method overload.
    - Added ControllerMap.ElementAssignmentConflicts(ControllerMap controllerMap, bool skipDisabledMaps) method overload.
    - Added ControllerMap.ElementAssignmentConflicts(ActionElementMap actionElementMap, bool skipDisabledMaps) method overload.
    - Added ControllerMap.ElementAssignmentConflicts(ElementAssignmentConflictCheck conflictCheck, bool skipDisabledMaps) method overload.
    - Added ControllerMap.RemoveElementAssignmentConflicts(ControllerMap controllerMap, bool skipDisabledMaps) method overload.
    - Added ControllerMap.RemoveElementAssignmentConflicts(ActionElementMap actionElementMap, bool skipDisabledMaps) method overload.
    - Added ControllerMap.RemoveElementAssignmentConflicts(ElementAssignmentConflictCheck conflictCheck, bool skipDisabledMaps) method overload.
    - Added ControllerMap.GetElementMaps(bool skipDisabledMaps) method overload.
    - Added ControllerMap.ElementMapsWithAction(int actionId, bool skipDisabledMaps) method overload.
    - Added ControllerMap.ElementMapsWithAction(string actionName, bool skipDisabledMaps) method overload.
    - Added ControllerMap.GetFirstElementMapWithAction(int actionId, bool skipDisabledMaps) method overload.
    - Added ControllerMap.GetFirstElementMapWithAction(string actionName, bool skipDisabledMaps) method overload.
    - Added ControllerMap.GetElementMapsWithAction(string actionName, bool skipDisabledMaps) method overload.
    - Added ControllerMap.GetElementMapsWithAction(int actionId, bool skipDisabledMaps) method overload.
    - Added ControllerMap.ButtonMapsWithAction(int actionId, bool skipDisabledMaps) method overload.
    - Added ControllerMap.ButtonMapsWithAction(string actionName, bool skipDisabledMaps) method overload.
    - Added ControllerMap.GetFirstButtonMapWithAction(int actionId, bool skipDisabledMaps) method overload.
    - Added ControllerMap.GetFirstButtonMapWithAction(string actionName, bool skipDisabledMaps) method overload.
    - Added ControllerMap.GetButtonMaps(bool skipDisabledMaps) method overload.
    - Added ControllerMap.GetButtonMapsWithAction(int actionId, bool skipDisabledMaps) method overload.
    - Added ControllerMap.GetButtonMapsWithAction(string actionName, bool skipDisabledMaps) method overload.
    - Added ControllerMap.ReplaceOrCreateElementMap(ElementAssignment elementAssignment, out ActionElementMap result) method overload.
    - Added ControllerMap.CreateElementMap(ElementAssignment elementAssignment, out ActionElementMap result) method overload.
    - Added ControllerMap.CreateElementMap(int actionId, Pole axisContribution, KeyCode keyCode, ModifierKey modifierKey1, ModifierKey modifierKey2, ModifierKey modifierKey3, out ActionElementMap result) method overload.
    - Added ControllerMap.CreateElementMap(int actionId, Pole axisContribution, KeyCode keyCode, ModifierKeyFlags modifierKeyFlags, out ActionElementMap result) method overload.
    - Added ControllerMap.CreateElementMap(int actionId, Pole axisContribution, int elementIdentifierId, ControllerElementType elementType, AxisRange axisRange, bool invert, out ActionElementMap result) method overload.
    - Added ControllerMap.ReplaceElementMap(ElementAssignment elementAssignment, out ActionElementMap result) method overload.
    - Added ControllerMap.ReplaceElementMap(int elementMapId, int actionId, Pole axisContribution, KeyCode keyCode, ModifierKey modifierKey1, ModifierKey modifierKey2, ModifierKey modifierKey3, out ActionElementMap result) method overload.
    - Added ControllerMap.ReplaceElementMap(int elementMapId, int actionId, Pole axisContribution, KeyCode keyCode, ModifierKeyFlags modifierKeyFlags, out ActionElementMap result) method overload.
    - Added ControllerMap.ReplaceElementMap(int elementMapId, int actionId, Pole axisContribution, int elementIdentifierId, ControllerElementType elementType, AxisRange axisRange, bool invert, out ActionElementMap result) method overload.
    - Added ControllerMapWithAxes.GetFirstAxisMapMatch method.
    - Added ControllerMapWithAxes.GetAxisMapMatches method.
    - Added ControllerMapWithAxes.ForEachAxisMapMatch method.
    - Added ControllerMapWithAxes.SetAllAxisMapsEnabled method.
    - Added ControllerMapWithAxes.DoesElementAssignmentConflict(ControllerMap controllerMap, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.DoesElementAssignmentConflict(ActionElementMap actionElementMap, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.DoesElementAssignmentConflict(ElementAssignmentConflictCheck conflictCheck, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.ElementAssignmentConflicts(ControllerMap controllerMap, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.ElementAssignmentConflicts(ActionElementMap actionElementMap, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.ElementAssignmentConflicts(ElementAssignmentConflictCheck conflictCheck, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.RemoveElementAssignmentConflicts(ControllerMap controllerMap, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.RemoveElementAssignmentConflicts(ActionElementMap actionElementMap, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.RemoveElementAssignmentConflicts(ElementAssignmentConflictCheck conflictCheck, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.AxisMapsWithAction(string actionName, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.AxisMapsWithAction(int actionId, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.GetFirstAxisMapWithAction(int actionId, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.GetFirstAxisMapWithAction(string actionName, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.GetAxisMaps(bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.GetAxisMapsWithAction(string actionName, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.GetAxisMapsWithAction(int actionId, bool skipDisabledMaps) method overload.
    - Added ControllerMapWithAxes.GetFirstElementMapWithAction(int actionId, bool skipDisabledMaps) method overload.
    - Added ReInput.ControllerHelper.ConflictCheckingHelper.DisableElementAssignmentConflicts method.
    - Added ReInput.MappingHelper.GetControllerMap method.
    - Added ReInput.MappingHelper.GetActionElementMap method.
    - Added PlayerIdPropertyAttribute.
    - Added Axis2DCalibration class.
    - Added Rewired.Platforms.WindowsStandalonePrimaryInputSource.XInput enum.
    - Added ElementAssignmentConflictInfo.player property.
    - Added ElementAssignmentConflictInfo.action property.
    - Added ElementAssignmentConflictInfo.controller property.
    - Added ElementAssignmentConflictInfo.controllerMap property.
    - Added ElementAssignmentConflictInfo.elementIdentifier property.
    - Added ElementAssignmentConflictInfo.elementMap property.
    - Added ElementAssignmentConflictInfo.elementDisplayName property.
    - Added InputMapper class.
    - Added InputMapper.Options class.
    - Added InputMapper.Context class.
    - Added InputMapper.EventData class.
    - Added InputMapper.InputMappedEventData class.
    - Added InputMapper.ErrorEventData class.
    - Added InputMapper.CanceledEventData class.
    - Added InputMapper.TimedOutEventData class.
    - Added InputMapper.StartedEventData class.
    - Added InputMapper.StoppedEventData class.
    - Added InputMapper.ConflictFoundEventData class.
    - Added InputMapper.ConflictResponse enum.
    - Removed obsolete Player.ControllerHelper.MapHelper.SetMapsEnabled(bool state, int categoryId, int layoutId) method overload.
    - Changed return type of Player.GetMaps(ControllerType controllerType, int controllerId) to IList<ControllerMap> from IEnumerable<ControllerMap>.
    - Changed return type of ControllerMap.AllMaps to IList<ActionElementMap> from IEnumerable<ActionElementMap>
    - Changed ControllerWithButtons.PollForAllButtons() to virtual.
    - Changed ControllerWithButtons.PollForAllButtonsDown() to virtual.
    - Moved ControllerWithMap functionality into Controller.

    Integration Changes:
    - PlayMaker:
    New Actions:
    RewiredControllerGetEnabled
    RewiredControllerSetEnabled
    RewiredPlayerGetFirstElementMapIdWithAction
    RewiredPlayerGetAxisDelta
    RewiredPlayerGetAxisRawDelta
    RewiredPlayerGetButtonRepeating
    RewiredPlayerGetNegativeButtonRepeating
    RewiredActionElementMapGetEnabled
    RewiredActionElementMapGetActionId
    RewiredActionElementMapGetElementType
    RewiredActionElementMapGetElementIdentifierId
    RewiredActionElementMapGetAxisRange
    RewiredActionElementMapGetInvert
    RewiredActionElementMapGetAxisContribution
    RewiredActionElementMapGetKeyboardKeyCode
    RewiredActionElementMapGetModifierKey1
    RewiredActionElementMapGetModifierKey2
    RewiredActionElementMapGetModifierKey3
    RewiredActionElementMapGetAxisType
    RewiredActionElementMapGetModifierKeyFlags
    RewiredActionElementMapGetKeyCode
    RewiredActionElementMapGetHasModifiers
    RewiredActionElementMapGetElementIndex
    RewiredActionElementMapSetEnabled
    RewiredActionElementMapSetInvert

    - Behavior Designer:
    New Tasks:
    RewiredControllerGetEnabled
    RewiredControllerSetEnabled
    RewiredPlayerGetFirstElementMapWithAction
    RewiredPlayerGetAxisDelta
    RewiredPlayerGetAxisRawDelta
    RewiredPlayerGetButtonRepeating
    RewiredPlayerGetNegativeButtonRepeating
    RewiredActionElementMapGetEnabled
    RewiredActionElementMapGetActionId
    RewiredActionElementMapGetElementType
    RewiredActionElementMapGetElementIdentifierId
    RewiredActionElementMapGetAxisRange
    RewiredActionElementMapGetInvert
    RewiredActionElementMapGetAxisContribution
    RewiredActionElementMapGetKeyboardKeyCode
    RewiredActionElementMapGetModifierKey1
    RewiredActionElementMapGetModifierKey2
    RewiredActionElementMapGetModifierKey3
    RewiredActionElementMapGetAxisType
    RewiredActionElementMapGetModifierKeyFlags
    RewiredActionElementMapGetKeyCode
    RewiredActionElementMapGetHasModifiers
    RewiredActionElementMapGetElementIndex
    RewiredActionElementMapSetEnabled
    RewiredActionElementMapSetInvert

    Bug Fixes:
    - Fixed bug causing Windows 8.1 Universal builds to always fall back to Unity input.
    - Fixed bug in ControllerMap.RemoveElementAssignmentConflicts(ControllerMap controllerMap) when called on a Keyboard Map.
    - Fixed bug in ControllerMap.RemoveElementAssignmentConflicts(ControllerMap controllerMap) which caused conflicting assigments to be removed from both controller maps.
    - Windows Standalone: Fixed hang on Unity 5.3+ when the application loses focus for more than 5 seconds with no mouse movement with "Run In Background" and "Exclusive Mode" set in the Unity Player properties while using Raw Input or Direct Input with Native Mouse Handling enabled.
    - Rewired Editor window now refreshes properly after stopping Play mode in the Editor.
    - Fixed bug in Rewired Editor where moving an Action to a different Action Category caused existing mappings using that Action to be cleared the next time you edited that mapping.
     
    Last edited: Mar 30, 2017
    flashframe, docsavage and Acissathar like this.
  2. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    Awesome release. Wow so many new suprises! The flight controllers are always welcome. Yea! Keep up the good work! It going to take a while to digest everything in this release.
     
    guavaman likes this.
  3. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    In the latest Rewired 1.1.0 release now includes CH Combatstick! It looks like all the CH Products joystick product line is completely covered now. Yea! This now includes about 99% of the most popular consumer flight controllers too based on the other controllers included.

    And even the little things are covered too. Now it is Rewired 1.1.0 release. :D
     
    guavaman likes this.
  4. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Sweet.

    You KNOW it's a serious release when @guavaman not only breaks away from 1.0.0.x, but skips right over 1.0.1.0.
     
    guavaman likes this.
  5. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    :)

    I've decided to move to a more structured versioning scheme that will go something like this:

    x._._._ - Major releases (criteria yet to be determined.)
    _.x._._ - Breaking API changes, deprecated API removed, other very significant changes/additions.
    _._.x._ - Backwards compatible API changes, new features added, non-error deprecations.
    _._._.x - Bug fixes only.
     
  6. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    Since you are into VR did you notice the new Oculus Rift controller definitions?

     
  7. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    The touch controls are a very nice surprise. A few people I know have Android tablets I was thinking of attempting a mobile build but was wondering what do for the controllers. Looks like you have answered that issue with this Rewired release.

    Have you tested this with a Nvidia Shield?
     
    Last edited: Mar 30, 2017
  8. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    I haven't but there's no reason it shouldn't work on it. The Shield Controller would work as well.
     
  9. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    So we'll have a Touch Controller as a Touch Control as well as Oculus Touch Controls. :D

    Yeah, I saw that, though I'd think the OpenVR ones might be more flexible for supporting Vive also. Definitely curious to see how that will work.
     
  10. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    On screen touch controls always kind of seemed out of scope for the product, so yeah, was not expecting that.
     
  11. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Even better, we've now got Control Mapper and Input Mapper. o_O Naming things is always hard.

    Control Mapper is a pre-made control remapping screen where as Input Mapper is a new class to use to listen for input and make assignments without having to get into the weeds with polling, conflict checking, creating Action Element Maps, etc. It's a response to a number of users who have expressed frustration and confusion on the somewhat complex API.

    They're just definitions for Unity's built-in Oculus Touch and OpenVR wrappers that make those devices appear as joysticks in the Unity Input system They don't support position or rotation information. They've been mapped to their Xbox 360 controller layout. I made them compatible with the Dual Analog Gamepad Template for that reason, so if you've made a map for that, the controllers will just work.

    Here's the Unity docs pages on the two controller types:
    https://docs.unity3d.com/Manual/OculusControllers.html
    https://docs.unity3d.com/Manual/OpenVRControllers.html

    Big caveat here: They only work with Unity input, not Raw/Direct Input because they're not really showing up as HID gamepads to Windows.

    I don't really see myself making them work natively because I don't want to be responsible for constantly keeping up with Valve and Oculus's APIs. The user I was working with already experienced the pains of this with Unity when he updated Unity and suddenly using the Oculus Touch through UnityEngine.Input caused the game to crash.

    What I might do in the future is to make a Component Control (new system that Touch Controls are based on) for Oculus Touch and HTC Vive. It's basically a wrapper around a Custom Controller. So it would make it easy to add support for Oculus Touch or HTC Vive by dropping a prefab into your scene. The script would feed the Custom Controller the values for the devices either grabbing them from UnityEngine.Input or from each of the device's libraries directly provided you have them installed. The only drawback I can think of is that the devices wouldn't be eligible for joystick auto-assignment because they'd be Custom Controllers instead of joysticks, but I could do something that would make Custom Controllers (or certain ones) be able to be treated as Joysticks so they'd work with the system more smoothly. (Heck, that approach might be cool for keyboards as well, allowing you to treat different fixed keyboard layouts as Joysticks for easy swapping, etc. Sorry, just thinking out loud.)

    I kind of agree, but a number of people have expressed disappointment that they have to buy/get something else for touch controls and mess with scripts to make them work. I have to admit though, it wasn't the most asked for feature. I added them for completeness sake because I don't want Rewired to be known as just be just a "controller input system" or mostly just good for desktop/console games.

    With the new touch controls, one can have touch input support now without adding a single script. Just do a little Custom Controller setup in the Rewired editor, drop the controls into the scene, configure them and it will work.

    On a different note, since you are into flight controllers and I know you've done a glyph system for your controls in the past, I thought you might be interested in these new CSV tables of all the controllers recognized by Rewired:

    http://guavaman.com/projects/rewired/files/docs/RewiredControllersCSV.zip
    http://guavaman.com/projects/rewired/files/docs/RewiredControllerElementIdentifiersCSV.zip

    The first file is just the controller names and guids. The second file is a long list of all controller element identifiers. Hopefully these will make building lookup tables easier until I can get around to adding some kind of localization and glyph system into Rewired. If you think it would be beneficial to have them in a different format, let me know.
     
    Last edited: Mar 30, 2017
    jons190 likes this.
  12. HittmanA

    HittmanA

    Joined:
    Jul 27, 2016
    Posts:
    45
    @guavaman I was wondering how I could get which direction a joystick is pointing. I know how to get input but I am not sure how to get which way a joystick (PS4 controller in this case) is pointing. I need to know basically what angle the joystick is facing (0/360 degrees for straight up, 90 for right, 180 for down, 270 for left, etc.). How would I do this?
     
  13. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Vector2.Angle

    All you're doing is getting the angle of a 2D vector.

    Code (csharp):
    1. float angle = GetAngle360(player.GetAxis2D("Horizontal", "Vertical"));
    2.  
    3. static float GetAngle360(Vector2 vector) {
    4.     if(vector == Vector2.zero) return 0f;
    5.     float angle = Vector2.Angle(Vector2.up, vector) * Mathf.Sign(vector.x);
    6.     return angle < 0f ? angle + 360f : angle;
    7. }
    If you really want the angle of the joystick and not the Actions, you do the same thing using Joystick.GetAxis2D.
     
    Last edited: Mar 30, 2017
    HittmanA likes this.
  14. HittmanA

    HittmanA

    Joined:
    Jul 27, 2016
    Posts:
    45
    Thank you!
     
  15. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Ah, I could see that as being useful. There are a good number of buttons on those. The Oculus Touch in particular does sort of map to a traditional gamepad between the two of them.

    It's possible that I'll end up working on a simple PSVR game, though it might not support the Move controllers. It'd be nice to someday have all of those motion controllers working under some sort of standard, but we're still in the early days of VR.

    Still, there are at least some standards coming:
    https://www.khronos.org/openxr/

    That is pretty sweet.

    Awesome, thanks. I'll check those out.
     
  16. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,015
    So glad I bought this asset. Loved it from day1 and it's got even better. With those touch controls added it will make life a lot easier as getting to end of making my game. Won't need to use another system for the mobile versions.

    Thanks @guavaman.
     
    flashframe and guavaman like this.
  17. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    730
    Agreed. This update looks awesome!
     
    docsavage likes this.
  18. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    When we thinking input mapping we just think Rewired by default. :cool: I need to look into the Input Mapper too.

    That sounds like an great solution for X-arcade Tankstick.
     
    guavaman likes this.
  19. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    Looking forward to your Flight Controller glyph system too.
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Indeed. Looking at the number of companies working on that... yeah... I don't think I'll be attempting to abstract VR controls myself any time soon. :p
     
  21. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Good idea! This can actually be done now, just without the joystick auto-assignment stuff. As long as you assign them yourself, Custom Controllers can do it. I made a quick keyboard controller script using a Custom Controller and it works fine.
     
  22. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    That is great news. I will have to give that a try.

    tankstick_joystick.jpg
     
  23. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    Agreed. Which mobile platforms are you targeting with your game?
     
  24. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
  25. Vampyr_Engel

    Vampyr_Engel

    Joined:
    Dec 17, 2014
    Posts:
    449
    No It hasn't besides we are talking about Joysticks which is what Rewired is all about Joystick ,joypad keyboard mouse enhanced input actually what its all about but well yes thats what its about
     
    Last edited: Mar 31, 2017
  26. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    I looked through a few pages and didn't see anything about this question. I didn't see it in the code but I was wondering....is the input manager object a singleton? It would help if it was, so I could just instance the prefab in all my scenes making it easy to test. If not, I can work something about, maybe making my own singleton object instance the input manager, but I wouldn't want to duplicate the behavior unless it is necessary. Thanks in advance.
     
  27. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Input Manager is the first topic in the documentation under the Concepts heading. The documentation page on it explains how the Input Manager works and how to work with it in multiple scenes when testing.
     
  28. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    910
    There it is. I actually read a good bit of the docs already but I missed that part somehow. Thanks for the quick support. It is exactly what I wanted, working like a singleton with duplicates destroying themselves. Good decision in my opinion.
     
    guavaman likes this.
  29. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    I picked up Rewired and I'm having trouble wrapping my mind around a concept and how to make it happen.

    I have actions defined for my game.

    I have mapped these actions to a couple controllers supported but it was tedious.

    The list of controllers supported is staggering long which is awesome but does this mean I have to map my actions to every single controller supported?! :eek:

    Am I missing something and what is the best way to support any controller plugged in for my game once I have actions defined?
     
  30. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    No, you don't. The documentation, the Quick Start, and the overview video all mention the Dual Analog Gamepad Template and that you should use it. Controller Templates save a tremendous amount of work when creating default mappings:

    Documentation: Controller Maps - Controller Templates

    Controller Templates (Applies only to "Joysticks"):

    A Controller Template represents a generalized controller layout that matches a number of supported controllers. When you create a map for a Template, any controller that is included in the Template will inherit that map automatically without the need for you to create a map specifically for that controller. For example, Rewired comes with a Dual Analog Gamepad Template. When you create a map for this Dual Analog Gamepad Template, you do not need to create individual maps specifically for any of the gamepads listed on this page because they are all covered by the Dual Analog Gamepad Template. This makes is much quicker to create pre-defined controller maps for a huge variety of controllers. Additionally, as more controllers are added to the Template in the future, the map you've already created will work with these new controllers as well.

    More from the Controller Maps page.

    There is no possible way to allow you to assign your Actions to any and every controller plugged in. There would be no way for you to know what element you're assigning those Actions to. You can assign them to the templates you want to support and the Unknown Controller, but that's as close as you can get to covering everything.

    The best way to get the most out of Rewired is always to read the documentation before you begin.
     
    Last edited: Apr 2, 2017
  31. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    Not sure if everyone has already seen this but since they do make game controllers I thought it would be good to post it here.

    Mad Catz files for Bankruptcy. More information from these two URLs.

    http://www.reuters.com/article/brief-mad-catz-interactive-makes-volunta-idUSFWN1H80KP

    https://globenewswire.com/news-rele...the-Bankruptcy-and-Insolvency-Act-Canada.html

    Thankfully at least they sold off the Saitek product line to Logitech before filing.

    If you own any Mad Catz controllers now is a good time download the latest drivers and manuals [for your controller(s)] from their website since no one knows how long the Mad Catz website will remain online. http://www.madcatz.com/
     
  32. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    @guavaman

    I just found this 4 player controller which is really exciting from the price point of $299. The price is really competitive compared to something like X-Arcade TankStick and it would be great for a 4 player Gauntlet style game. For example using Deftly (unity asset) and Rewired would be great.

    Xtension_4player.JPG

    https://www.recroommasters.com/Xtension_4_Player_Control_Board_p/rm-xt-sd-board-4p.htm

    = = = = = =

    I also did not know that any company made dedicated USB paddle controllers other than Atari (for the 2600) and other companies of that time period.

    horizontal_ctrl_paddle.JPG

    http://www.ubergizmo.com/2012/01/horizontal-controller/

    http://bit-trade-one.com/hori-con/
     
    Last edited: Apr 2, 2017
    guavaman likes this.
  33. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    guavaman likes this.
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Wow that looks great! They have 2-player versions as well I see. Reading the specs, it appears as a keyboard, so it will already just work with Rewired with a little user mapping before the game. Nice.

    Now these are super cool! That would be perfect for Warlords, my favorite party game from way back. Nice find!
     
  35. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Looks like they have some nice products. I had see the Gladiator II before, but not the others. Quite industrial, especially these:

    VKB-SimGunfighter.jpg

    VKB-SimGunfighterPro.jpg
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Wow. That's sad. They make a lot of good stuff. Thanks for the heads up.

    One of their gamepads I would have liked to add to Rewired but haven't because of its absurd price:
    Lynx 3

    Looks like they have a few new gamepads I hadn't seen before also like the Surf R.
     
  37. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    They did have one model with both a track ball and a spinner which is rare to see.

    I would be nice to make a custom 4 paddle controller that uses a normal game controller axis instead of the standard mouse. It seems like that would be easier for games like warlords and probably cheaper construction.

    Warlords was a great game indeed. It would be great to have a 8 player variant where you would have a castle in the middle of the screen that 4 players are defending and the normal 4 players on the outside. So in Exhibit A: the castle in the middle would be where I drew the blue circle.


    Exhibit A:

    warlords_8_player.JPG
     
  38. Vampyr_Engel

    Vampyr_Engel

    Joined:
    Dec 17, 2014
    Posts:
    449
    No I hadn't heard of them Looks like they do some nice solid gear I will have to check out what else they do Yeah their products look nice rugged and cool I wonder if they do a H.O.T.A.S?
     
  39. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    They are based on a Russian design. In addition to this WWII style flight controller they are working on a more modern design based on Russian fighter jets (e.g. T-50).
     
  40. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    They working on a throttle for a HOTAS system but I am not sure how far along in the design process they are.
     
  41. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    It is sad. It will be interesting to see if local stores drop prices significantly as a result.
     
  42. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Interesting. It will be good to have more options in the flight controller space.

    Perhaps some controllers will become collectors items.

    Yes, that would be better than using the mouse.

    I like the idea. Going to make it? :D
     
  43. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    Those Fightstick are really expensive (must be the branding) but in general they seem to be the same price as flight controllers. Seems like a X-arcade TankStick would be a better option but there must be something about them that makes them so popular. There are other companies that make similar fightsticks. This Mad Catz model is $229 retail price for example.

    Mad_Catz_FightStick_TE2plus_01_1024x1024.jpg
     
  44. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    It would be fun to actually make a dedicated USB controller with 4 dials on it. It seems like 4 dials and 4 potentiometers and one of those USB boards should be straight forward. The USB drivers will probably be more work depending on the USB board.

    It would be a fun exercise. :)
     
  45. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    According to the product page, the stick uses the same parts as the Japanese arcade machines, which is probably an important selling point. It also works on PS3/PS4 without an adapter.

     
  46. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    I'm pretty sure you could get away with just using the standard HID driver. Most HID devices don't require a separate driver. I guess if you wanted to make it show up as 4 separate devices it would though.
     
  47. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    Rewired 1.1.0.0 is now live on the Unity Asset Store!
    Please see this post for detailed information on this update.

    The most notable new features:
    1. Touch Controls: On-screen touch and tilt controls for mobile platforms. (Unity 5.0+)
    2. Input Mapper: Allows for much easier control remapping from scripting.
    3. Action Element Maps can now be individually enabled and disabled.
    4. Controllers can now be enabled and disabled.
    5. A number of new examples are included.
    6. Some great new flight controllers!
    7. A lot more. (See release notes.)
     
  48. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,549
    That great news that Rewired 1.1.0 available already. So many things to try out.

    @Intense_Gamer94
     
  49. crypt0

    crypt0

    Joined:
    May 25, 2015
    Posts:
    55
    Hi,

    I want to use the new TouchControl - It is really simple to setup. Nice work!!! But ;) , I saw that there is a option in the joystick script called "Center Stick on release". I want to disable this feature for only one axis. Is it possible? I can't find any other option which does allowed me to disable this function on only one axis.

    Thanks

    Edit: Another thing is, that I don't figured out, how to set the default value of one axis, so that this axis starts at -1. I want an axis, which does not center on release and with an default start value of -1.
     
    Last edited: Apr 4, 2017
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,501
    There is no option to center only one axis and not the other. You can restrict the joystick to use only X or Y though with the Axes to Use field.

    There is also no option to set the initial value or the final center value. (The final center value logically should be able to be set in the calibrated zero, but I did not account for that possibility and will have to change it to make it recenter to the calibrated zero instead of 0).

    To do what you want you'd have to use a script. This script will make the joystick stick to 0, Y. It seems very odd to have the Y axis not recenter as you will see when you try it, but this does what you are asking:

    Code (csharp):
    1. using UnityEngine;
    2. using Rewired.ComponentControls;
    3.  
    4. [RequireComponent(typeof(TouchJoystick))]
    5. public class TouchJoystickCenterXNotY : MonoBehaviour {
    6.  
    7.     TouchJoystick joystick;
    8.     Vector2 value;
    9.  
    10.     void OnEnable() {
    11.         joystick = GetComponent<TouchJoystick>();
    12.         joystick.ValueChangedEvent += OnValueChanged;
    13.         joystick.TouchUpEvent += OnTouchEnded;
    14.     }
    15.  
    16.     void OnDisable() {
    17.         joystick.ValueChangedEvent -= OnValueChanged;
    18.         joystick.TouchUpEvent -= OnTouchEnded;
    19.     }
    20.  
    21.     private void Start() {
    22.         joystick.SetRawValue(new Vector2(0, -1));
    23.     }
    24.  
    25.     public void OnValueChanged(Vector2 value) {
    26.         this.value = value;
    27.     }
    28.  
    29.     public void OnTouchEnded() {
    30.         joystick.SetRawValue(new Vector2(0f, value.y));
    31.     }
    32. }
     
    Last edited: Apr 5, 2017