K
K
Klaxons2019-07-12 11:25:25
iOS
Klaxons, 2019-07-12 11:25:25

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

3 answer(s)
B
briahas, 2019-07-12
@briahas

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

Y
YURIY KOZLOV, 2019-07-12
@WizardNG

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.

K
Klaxons, 2019-07-12
@Klaxons

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 question

Ask a Question

731 491 924 answers to any question