Skip to 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
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Game Physics Engine Development, 2nd Edition

Game Physics Engine Development, 2nd Edition

Ian Millington

Publisher Resources

ISBN: 9781449361037Errata Page