Skip to Content
Mastering UI Development with Unity
book

Mastering UI Development with Unity

by Dr. Ashley Godbold
April 2018
Beginner content levelBeginner
468 pages
11h 7m
English
Packt Publishing
Content preview from Mastering UI Development with Unity

Accelerometer and gyroscope

Most mobile devices have a built-in accelerometer, and many also have a gyroscope. Without getting too technical in describing how it actually works, the difference between the accelerometer and the gyroscope is what they measure. The accelerometer measures acceleration within the 3D coordinate system, and the gyroscope measures rotation.

You can access data from the device's accelerometer using the Vector3 Input.acceleration property.

The coordinates of Input.acceleration line up with the scene based on the rotation of the device, as shown:

Simple examples of this involve moving an object around a scene when the ...

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 Development with Unity for .NET Developers

Game Development with Unity for .NET Developers

Jiadong Chen
Unity UI Cookbook

Unity UI Cookbook

Francesco Sapio

Publisher Resources

ISBN: 9781787125520Supplemental Content