Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Feature Request 1D Axis "WhichSideWins" type that takes both (-,+) values into account

Discussion in 'Input System' started by Gawidev, Dec 7, 2022.

  1. Gawidev

    Gawidev

    Joined:
    Jan 28, 2021
    Posts:
    8
    Case scenario: a need for a singular 1D axis with positive/negative bindings to be affected by both inputs when they are simultaneously activated.
    Example: Having a freecam/noclip cam with vertical movement controlled by the left and right triggers of a controller or any other kind of analog inputs. Currently if this is attempted, smooth transition from one input to another is impossible as one value (or both) will always be overridden.

    Feels like this should be something that comes as an option by default with the 1D axis, dunno if there's something I'm missing that would make it incompatible with something at some level but I made an example implementation of a WhichSideWins type that reads both axis inputs and gets a result from them without overriding some of them.

    Comparison of what the current 1D axis solution does vs what my example code does.

    Ill attach the code thats a simple addition to the currently existing AxisComposite script. Only parts that were changed were the WhichSideWins enum and the ReadValue function (and of course the necessary Unity Editor only compile code so the Composite can appear in editor).


    PS the input system is awesome ty for its extensive documentation :)
     

    Attached Files: