Answer the question
In order to leave comments, you need to log in
How to set the game joystick value to change exponentially?
There is a joystick with a range of values -1.500...1.500 with a point 0 in the center
there is a certain variable a, which increases while the joystick stick
is moving. ", and you start to drown on the floor, the speed starts to grow exponentially and the step of changing the speed changes conditionally from +1 to + 10 (a certain constant)
, so I can't figure out how to implement this?
At the input there is only a joystick value from -1.500 to 1.500
Answer the question
In order to leave comments, you need to log in
It's not entirely clear what the gag is - you yourself say "exponentially". Well, use the exponent formula to translate the joystick deflection into some variable a
I would try to make two formulas.
1. Variable change rate depending on the current readings of the joystick.
2. The maximum value of the variable depending on the current readings of the joystick.
Well, and on them considered a variable.
There are indications of the joystick. We consider the speed and the maximum value. Adds speed to the current value of the variable. If the result is less than the maximum, this is the new value of the variable; if it is greater, the variable is equated to the maximum.
The same goes for the negative direction.
At first glance, increasing the previous value by the value of the exponent of the joystick position is suitable, but it is not clear how to “beautifully” hold the speed if the verse does not move but is shifted relative to 0 and is pressed (as in the example with the gas pedal when lightly touching it)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question