Skip to Main Content
Physics for Game Developers, 2nd Edition
book

Physics for Game Developers, 2nd Edition

by Bryan Bywalec, David M Bourg
April 2013
Intermediate to advanced content levelIntermediate to advanced
575 pages
15h 54m
English
O'Reilly Media, Inc.
Content preview from Physics for Game Developers, 2nd Edition

Chapter 21. Accelerometers

Accelerometers are a good introduction to a class of electronic components called microelectromechanical systems (MEMS). An accelerometer can either be one-axis, two-axis, or three-axis. This designates how many different directions it can simultaneously measure acceleration. Most gaming devices have three-axis accelerometers.

As far as game development is concerned, acceleration values are typically delivered to your program via an API with units in multiples of g. One g is equal to the acceleration caused by gravity on the Earth, or 9.8 m/s2. Let’s pretend that we have a one-axis accelerometer and we orient it such that the axis is pointing toward the center of the earth. It would register 1g. Now, if we travel far away from any mass, such that there is no gravity, the accelerometer will read 0. If we then accelerate it such that in one second it goes from 0 m/s to 9.8 m/s, the accelerometer will read a steady 1g during that one-second interval. Indeed, it is impossible to tell the difference between acceleration due to gravity and acceleration due to changing velocity.

Real-life motion is generally nonsteady. Depending on your application’s goals, you might have to apply different smoothing functions such as high-pass or low-pass filters. This amounts to digital signal processing, a topic that has consumed entire texts. One example we can recommend is Digital Signal Processing: A Computer Science Perspective by Jonathan Y. Stein (Wiley).

Also, many accelerometers ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Game Physics Engine Development, 2nd Edition

Game Physics Engine Development, 2nd Edition

Ian Millington

Publisher Resources

ISBN: 9781449361037Errata PageSupplemental Content