1
\$\begingroup\$

Actually I want to edit my previous question titled What is the geometrical interpretation of Input.GetAxis("Mouse X") and add a related question "What is the physical interpretation of Input.GetAxis("Horizontal")?" to it.

However, I was asked to create a new question about it.

The longer I press the key, the greater the value returned by Input.GetAxis("Horizontal"). If I don't press, it returns 0. The value seems to be a function of time interval the key is pressed. What is the empirical relationship between the relevant quantities?

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

Althought the doc covers how this works, it does not state why it does it like that.

I don't have first hand experience with that, but here is what I think.

Keyboard keys don't naturally offer gradual values like other types of input such as mouse/finger drag speed, joystick axis, etc. This gradual value returned for the keys lets you emulate a joystick that is "slowly" deflected to its maximum.

It's useful in situations where you need to roughly test something when you don't have access to joysticks (it's not a drop in replacement), or it could be useful in situations where you'd want to move a slider in the UI (e.g. for the volume), or any other object with more or less precision.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .