Game Development Reference
In-Depth Information
input.y = 0.0f;
return;
}
// Y is outside of the dead zone, but we still need to
// interpolate it so we don
'
t see any popping.
// Map Y values [actualDeadZone, 1.0f] to [0.0f, 1.0f]
float normalizedY = (input.y - actualDeadZone) / (1.0f - actualDeadZone);
input.y = normalizedY;
}
Normalizing Input
Even though the game controller thumbsticks have a circular area of movement, the
inputs for X and Y only reach 1.0 at the very top, bottom, left, and right of the circle.
In other words, X and Y are mapped to a Cartesian space, not a circular space. Take
a look at Figure 9.3, and you ' ll see what I mean.
Imagine what happens when a player pushes a control diagonally up and to the left.
On some controllers, you
ll get values for X and Y that are close to their maximum
range and probably look something like (
'
0.95f, 0.95). The reason for this is how the
Figure 9.3
Normalized input from a two-axis controller.
 
 
Search WWH ::




Custom Search