Positioning the moon

Now, we will position the moon relative to the earth. To assist, let's change our scene to the top-down orthographic view:

  1. In the Scene window, use the view gizmo in the upper-right corner to give a top view (click on the y-axis arrow).
  2. Click on the box in the center of the gizmo for orthographic.

The Scene window should look something like this:

The moon is 3,84,400 km from the earth. The diameter of the earth is 12,756 km. As per our units, one Unity unit equals the earth's diameter. So, if we position the moon accurately proportional to the sizes of the bodies, it is 30.13 units from the earth:

  1. Set the Moon's Transform Position to (30.13, 0, 0).
  2. Enable Earth by selecting it in Hierarchy and rechecking its enable box in Inspector.
  3. Zoom out so both are visible.

At this point, your Scene window may look like this, with a tiny earth and an even smaller moon:

Whoa! That's a huge distance. We have to zoom out to get both in view. The earth and the moon look so small. This might be accurate, but it's not great for visualization.

Let's just eyeball it and compress the size of space to about 5 percent of the actual distance, where 30.15/20 is about 1.5:

  1. Set Transform Position to (1.5, 0, 0).

This looks better for our purposes, as shown in the following screenshot:

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

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