Quote:
Originally Posted by agartner01
If the most positive value is 1 and the most negative value is -1, what I've done in the past is added 1 and divided by 2 (to the joystick value). Also, an exception needs to be put in place when is the value is -1 because -1+1=0/.5 results in potentially undefined behavior (at least in c++).
|
There are 2 things wrong with the last sentence above.
1) Dividing zero by something does not result in undefined behavior. Dividing something by zero does.
2) 0/.5 is not dividing by 2. It is dividing by 1/2, which is multiplying by 2.