官术网_书友最值得收藏!

Adding a plane

Now, let's add a ground plane object into the scene.

In the Hierarchy panel, click on the Create menu (or main GameObject menu) and choose 3D Object | Plane.

A default white plane is added to the scene, centered on the ground plane at Position (0, 0, 0). (If necessary, select Reset from the Inspector panel's Transform component's gear icon). Rename it to GroundPlane.

Note that at a scale of (1, 1, 1), Unity's plane object actually measures 10 by 10 units in X and Z. In other words, the size of GroundPlane is 10 by 10 units and its transform's Scale is 1.

The cube is centered at Position (0, 0, 0), just like the ground plane. However, maybe it doesn't look like it to you. The Scene panel may show a Perspective projection that renders 3D scenes onto a 2D image. The Perspective distortion makes the cube not seem centered on the ground plane, but it is. Count the grid lines on either side of the cube. As you'll see, when it is viewed in VR and you're actually standing in the scene, it won't look distorted at all. This is shown in the following screenshot:

The cube is submerged in the ground plane because its local origin is at its geometric center—it measures 1 by 1 by 1 and its middle point is (0.5, 0.5, 0.5). This might sound obvious, but it is possible for the origin of a model to not be its geometric center (such as one of its corners). The Transform component's position is the world space location of the object's local origin. Let's move the cube as follows:

  1. Move the cube onto the surface of the ground plane—in the Inspector panel, set its Y position to 0.5: Position (0, 0.5, 0).
  2. Let's rotate the cube a bit around the y axis. Enter 20 into its rotation: Rotation (0, 0.5, 0).

Note the direction in which it rotates. That's 20 degrees clockwise. Using your left hand, give a thumbs-up gesture. See the direction your fingers are pointing? Unity uses a left-handed coordinate system. (There is no standard for the coordinate system handedness. Some software uses left-handedness, others use right-handedness).

Unity uses a left-handed coordinate system. And the y axis is up.

主站蜘蛛池模板: 清水河县| 遵义市| 唐河县| 涡阳县| 娄底市| 宣威市| 临夏市| 盘锦市| 突泉县| 青铜峡市| 昌都县| 西贡区| 昭通市| 旺苍县| 天门市| 清丰县| 北宁市| 黔西| 彝良县| 高密市| 滁州市| 仪陇县| 奈曼旗| 江北区| 高平市| 潮州市| 林芝县| 建平县| 桂林市| 观塘区| 莱西市| 隆子县| 五台县| 仁化县| 霍城县| 五河县| 西盟| 平定县| 海林市| 岑溪市| 新化县|