From the course: Advanced iOS App Development: Core Motion
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Model accelerometer movement - iOS Tutorial
From the course: Advanced iOS App Development: Core Motion
Model accelerometer movement
- [Instructor] There's two sensors we'll work with: the accelerometer and the gyroscope. The accelerometer measures acceleration in three dimensions, measured in G's. Core Motion Manager returns an accelerated data object which has a structure CM acceleration that gives us acceleration in X, Y, and Z. For simplicity, I'm going to ignore Z for a while to keep us two dimensional with X and Y. Our fencing app will have two motions we describe with the accelerometer. The first is an attack or thrust. In fencing this is thrusting the foil or sword directly into an opponent. As a motion we can describe this as an acceleration on the Y-axis. At some value for acceleration, we'll consider it a thrust and print that on the console. This leads to an important question; how much acceleration is a thrust and how much is just putting your arm out? In Core Motion you'll need real life values to figure that out. In our app, close the console. In our app, go to start timer. Add the following to get…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.