如何修正导入模型的旋转? How do I fix the rotation of an imported model?

时间:2022-12-19 17:48:47

原地址:http://game.ceeger.com/Manual/HOWTO-FixZAxisIsUp.html

Some 3D art packages export their models so that the z-axis faces upward. Most of the standard scripts in Unity assume that the y-axis represents up in your 3D world. It is usually easier to fix the rotation in Unity than to modify the scripts to make things fit.

一些3D制作包导出的模型是Z轴向上的,在Unity中大多数标准脚本,假设Y轴在3D世界中表示向上的。在Unity中非常容易修正旋转而不用修改脚本。

如何修正导入模型的旋转? How do I fix the rotation of an imported model?

Your model with z-axis points upwards 你的模型是Z轴向上

If at all possible it is recommended that you fix the model in your 3D modelling application to have the y-axis face upwards before exporting.

如果有可能,建议你在导出前在3D建模软件中修正模型以便使Y轴向上。

If this is not possible, you can fix it in Unity by adding an extra parent transform:

如果做不到这一点,你可以在Unity中添加额外的父变换来修正它。

  1. Create an empty GameObject using the GameObject->Create Empty menu 
    使用GameObject->Create Empty菜单创建一个空的GameObject(游戏物体)
  2. Position the new GameObject so that it is at the center of your mesh or whichever point you want your object to rotate around. 
    定位这个新的游戏对象,使他位于网格的中心或者想要物体围绕旋转的点上
  3. Drag the mesh onto the empty GameObject 
    拖拽网格到这个空的游戏对象上

You have now made your mesh a Child of an empty GameObject with the correct orientation. Whenever writing scripts that make use of the y-axis as up, attach them to the Parent empty GameObject.

现在你已经将网格作为一个具有正确方向的游戏对象的子物体了,写脚本的时候使用Y轴向上,并将他们附加给这个空的父物体上。

如何修正导入模型的旋转? How do I fix the rotation of an imported model?

The model with an extra empty transform 带有一个额外空变换的模型