Unity Virtual Reality Projects
上QQ阅读APP看书,第一时间看更新

A few observations

The back of the cube is facing us. Is that a mistake? Actually, it makes sense since the current viewpoint is looking forward. So, we should see the back of the cube. If you didn't notice already, the same goes for Ethan. It also seems like the cube has a one-unit dimension.

However, on closer examination, in the cube's Inspector panel, you'll see it imported with the scale that we gave it in Blender (0.5, 0.5, 0.5). Also, it has an rotation of -90 (minus 90). Thus, if we reset the transform, that is, the scale to (1,1,1), it'll be 2 units in our world space and tipped over (so, don't reset it).

There's not much that we can do to compensate for the rotational adjustment without going back to Blender. But the scale can be adjusted in the model's Import Settings (in Inspector).

Blender's default up direction is Z, while Unity's is Y. Importing with a -90 rotation adjusts for that. An imported scale can be adjusted in the object's Inspector panel's Import Settings.

We have more control when it comes to exporting FBX from Blender. As shown in the screenshot, during Export you can customize the settings, for example, making Y the up axis and Z the forward one and setting the scale factor for import:

Before ending the preceding process, select UprightCube from the Hierarchy panel and drag it into the Project panel's Assets folder. (You may consider making an Assets/Prefabs subfolder and placing it into that.) This makes it a reusable prefab, texture image and all.

There are some important lessons in this exercise (other than having learned a little bit about Blender) that apply to any 3D Unity project, including the VR ones. Normally, you will be importing models that are much more complex than a cube. You will likely run into issues related to data conversion, scale, orientation, and UV texture images that might be confusing at best. If this happens, try to break the problem into smaller, more isolated scenarios. Do little tests to gain insight into how applications exchange data and to help you understand which parameter tweaks might be necessary.