Adding SolarSystem

SolarSystem will be parented by a root or anchor object. It is this anchor that will be positioned in the real world to place the solar system. Let's place SolarSystem about 3 meters in front of you when you first launch the app:

  1. In the Hierarchy root, create an empty object named Root and reset its Transform.
  2. Then, set its position Z to -3.
  3. Drag the SolarSystem prefab from the Assets/SolarSystem/Prefabs/ folder as a child object of Root.
  4. Set its transform position to (0, 0, 0) and scale to (0.03, 0.03, 0.03).

The scale of 0.03 looks good to us; you may decide to choose other values if you want.

  1. For our scene, the sun will provide illumination, so we can delete directional light from the scene if present.

You can go ahead and build and run the app now to see how it looks. It will open Xcode to complete the build. Refer to the iOS steps detailed in Chapter 3, Building Your App, and/or Chapter 4, Augmented Business Cards (the Building for iOS devices section) for specifics and troubleshooting.

You should see the planets about 3 meters in front of the device, but they're not moving. If you recall from our previous implementation of the Gametime variable (see the Adding a master speed rate UI section), to animate their orbits (and we do), we need to create a GameController object.

  1. In the Hierarchy root, create an empty object named GameController.
  2. Find the MasterControls script (in the Assets/SolarSystem/Scripts/ folder) and drag it as a component to GameController.

Now build and run again and the planets will be animated, at full speed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset