Announcement

Collapse
No announcement yet.

UNREAL 4.21 - How to find out if an Axis Mapping button is pressed or released?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    UNREAL 4.21 - How to find out if an Axis Mapping button is pressed or released?

    Hi, i´m implementing a Fuel system, each time my vehicle moves, it decreases fuel value…. the big problem i have, is that any InputAxis have a pressed and released option as Action Mapping Inputs have…. then, i canot find out if a button from "Inputaxis MoveRight" for example is been pressed and released.

    I started solving this issue, by adding each of its buttons like A, D, Left, Right (wich do have pressed released), same for others, forward, etc, BUT... I canot do this for any GamePad Motion Controller, for example (L) Tuhmbstick X, because they only have integer values, and my fuel system becomes useless for gamepad.

    What can i do, to figure out if an InputAxis (Axis Mapping) is been pressed or released?
    Last edited by RoccoFX; 01-31-2019, 05:00 AM.

    #2
    You simply cannot do this. An Axis is a continous value.

    If you want to check whether a direction is pressed, you need to check whether the InputAxisValue is != 0.

    Keep in mind that AxisValues accumulate. I.e. if you have a single Axis bound to two buttons and press both buttons, you will receive an accumulated value of both pressed
    For example A + D will result in 0 (-1.0 + 1.0 = 0)

    Comment


      #3
      Exactly, i understand, But… it is still a big problem in UE4 because it makes imposible to trigger any effect, or in my case use a fuel systems based on a vehicle movement, maybe there is other ways, please help.
      Last edited by RoccoFX; 01-31-2019, 03:58 PM.

      Comment


        #4
        Check float value of axis you want to check, is it > than, say, 0.3 (or, less than -0.3), if so - boolean this for some action you need.

        Comment


          #5
          What Thunder_Owl said is a good method.

          But maybe you could even base the fuel drain on vehicle velocity, where the more the velocity, the more the fuel usage?
          Artstation

          Comment


            #6
            In this case, i do not use use velocity for every tipe of movement, just for some types of movements, like forward, but i do not use velocity for other movemens like side moves.

            Comment


              #7
              There is a get forwards velocity node
              Artstation

              Comment

              Working...
              X