Game Development Reference
level of sensitivity. Another example would be to control the throttle on a car by using
the values of 0 to 255 as thrust multipliers.
Another use of knowing a button's position would be tracking it over time. With a time
history of position, you can differentiate to get velocity and again to get acceleration.
This would allow the program to differentiate between a button that is either slowly
depressed or quickly depressed. Most hardware doesn't help you here, so you'll have to
store the values and calculate the velocities in whatever increments are appropriate for
your program. As real-time velocity sensing might be taxing to the user as real-time
input, the best use would be as input to something that the user doesn't have to control
constantly. Imagine having to keep a button pressed down at the correct pressure for
your gameplay for longer than a few minutes; I can feel my wrist cramping now. How‐
ever, the pressure button is useful for many inputs. For example, how far a button is
pressed down might be used to draw back the head of a putter, while the speed at which
the button is released could be used to determine the speed at which the putter is brought
back to the ball.
Beyond simple buttons, there are other novel ways to use pressure sensors to allow a
user to interact with your games. For example, Nintendo's Wii uses a balance board
peripheral based on load cells to detect a person's stance.
The original idea for the Nintendo balance board came to video game
designer Shigeru Miyamoto after he was inspired by watching sumo
wrestlers weigh themselves with each leg on a different scale. They are
too heavy to use one scale!
Load cells work differently than the pressure-sensitive buttons described previously, but
like pressure-sensitive buttons, they come in different types, all of which measure the
load pressing on them. The most common way, and the one used in the Nintendo
balance board we'll discuss shortly, is through what is called a strain gauge .
A strain gauge, as you might be able to guess, does not measure force directly but instead
measures how much strain the gauge is experiencing. Strain is a measure of how much
a rigid body has deformed independent of its rigid-body motion. While there are several
notions of strain in continuum mechanics, the one we are concerned with here is often
referred to as engineering strain . This type of strain quantifies how much a structural
element has deformed compared to its original, or rest , length. We normalize this by
dividing the change in length over the rest length. By testing the material, one can
develop a stress versus strain curve that relates how much stress it takes to cause a certain