The earth orbiting around the sun

We can reuse the Orbit script we wrote for the moon for the earth's orbit around the sun. Of course, where the earth goes, our moon goes too, so we're actually orbiting the earth-moon object:

  1. Select the Earth-Moon object from Hierarchy.
  2. Add Component | Scripts | Orbit.
  3. Drag the Sun object from Hierarchy onto the Around Body slot.
  4. Set Orbital Period to 365.25 (days in a year).
  5. Save the scene and the project, then press Play.

Try changing Gametime Per Day of GameController between 24 and 0.05.

Get Augmented Reality for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.