Game Development Reference
In-Depth Information
Turning space orientation into controls
Onscreen controls are quite good, but they can be considered as a compromise, a
way to reconcile two worlds: the one with physical buttons and a brand new one with
some new principles where traditional controls are not an option anymore. But what
about the truly new approaches that are written from scratch? Is it possible? Sure!
Moreover, iOS devices have interesting tiny sensors that might be useful: the accel-
erometer and the gyroscope. As a rule, beginners are a little bit confused about the
exact functions and difference between these sensors. By a general description, they
might look pretty similar. They are tiny instruments that measure some orientation
parameters of a mobile device. In reality, each sensor has its own features. The ac-
celerometer is a traditional part of the iOS platform. It can gauge the acceleration re-
gistering values of forces that disturb the device. Because the sensor has three axes
of sensitivity, the orientation relative to the ground surface can be calculated. The
simplest example of using an accelerometer is switching between landscape and por-
trait screen modes while a device is rotating. But the sensor also has a drawback. It
is efficient for stationary objects rather than the moving ones. To overcome this point,
a backup system should be used. This is why in iPhone 4, the gyroscope was in-
troduced. It is a tiny device that is capable of measuring the exact rotation degree
around the roll axis. It is created to be independent of the movement of the system.
It is placed inside, playing the role of a constant criterion. It is funny to think that
there are tiny rotors, gimbals, and other elements that a traditional mechanical gyro-
scope has, but that is not true; otherwise, all these mechanical parts would take too
much space. In reality, as a rule, some other technological approaches are used in
electronic devices, for example, vibrating structure gyroscopes. They are based on
principles that are close to the orientation-measuring system that some flying insects
have. These creatures use specially modified hind wings known as halters as mech-
anical constants. They are vibrating permanently during flight (making the distinctive
high-pitch noise that humans can perceive). When some force is trying to change a
rotation angle of the insect's body, the halters resist (it is hard to change the plane of
vibration) involuntarily by pressing some special sensors; thus, the angle is measured
by the insect. Microscopic vibrating gyroscopes inside electronic devices have their
own halters. They look like solid-state elements of a specific shape. They vibrate with
a special frequency.
The idea of a working partnership between the accelerometer and the gyroscope
comes from such complex systems such as the orientation device in aircrafts. Work-
Search WWH ::




Custom Search