Skip to Content
Augmented Reality for Developers
book

Augmented Reality for Developers

by Jonathan Linowes, Krystian Babilinski
October 2017
Intermediate to advanced
548 pages
13h 23m
English
Packt Publishing
Content preview from Augmented Reality for Developers

Switching views

When SolarSystem is at position (0, 0), the sun is centered at our marker. When SolarSystem is at position (-5, 0), the earth is on the marker. In this way, we can recenter our view by switching between bodies in the center using the object's Transform position relative to the SolarSystem parent.

Let's write a script for this. We'll attach it as a component to GameController:

  1. In GameController, add Component | New Script and name it PlanetView.

Open the script and edit it as follows:

File: PlaneView.cs public class PlanetView : MonoBehaviour { public Transform solarSystem; public Transform planet; void Update () { Vector3 position = solarSystem.localPosition; if (planet != null) { // move solar system so planet is in 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

Augmented Reality Game Development

Augmented Reality Game Development

Micheal Lanham
Augmented Reality

Augmented Reality

Joseph Rampolla, Greg Kipper

Publisher Resources

ISBN: 9781787286436Supplemental Content