将模型导入3DS Max到Unity时出现缩放和旋转问题

时间:2018-09-20 09:10:14

标签: unity3d 3dsmax 3ds

我刚刚在3ds Max中设计了简单的3d模型,并尝试在Unity中导入。但是请注意一件与我无关的事情,我在X度上旋转了-90度,并且模型的比例也不正确。

我是3ds max软件的初学者,我不知道这是什么原因。

enter image description here

根据上图,希望您理解我的观点,因此我需要在3ds max软件中进行什么样的设置,以便导入时X轴旋转0度,比例为(1,1,1)。

请给我一些建议。

3 个答案:

答案 0 :(得分:1)

我已将此插件用于Blender,对我来说非常有用:

Unity Rotation Fix for Blender

如果找不到3DS Max的插件,则可以尝试自己编写类似的插件或将模型导出到Blender,然后使用该插件。

这是链接被弃用的原始Python代码:

import bpy

bl_info = {
 "name": "Unity Tools",
 "author": "Karol \"Mirgar\" Głażewski",
 "version": (1, 0, 2),
 "blender": (2, 6, 5),
 "location": "3D View > Tool Shelf > Unity Tools",
 "description": "Tools to ease workflow with Unity Engine",
 "warning": "",
 "wiki_url": "",
 "tracker_url": "",
 "category": "Object"}

# fixes rotation on X axis, +X is -X in Unity compared to Blender
class UnityRotationFixerX(bpy.types.Operator):

    bl_description = "Fixes rotation of object so it will not \"lay on its face\" in Unity, +X axis is -X compared to Unity"
    bl_label = "Simple rotation fix"
    bl_idname = "object.unity_rotation_fix_x"
    bl_options = {'REGISTER', 'UNDO'}


    def FixRotationForUnity3D(self):
        bpy.ops.object.transform_apply(rotation = True)
        bpy.ops.transform.rotate(value = -1.5708, axis = (1, 0, 0), constraint_axis = (True, False, False), constraint_orientation = 'GLOBAL')

        bpy.ops.object.transform_apply(rotation = True)
        bpy.ops.transform.rotate(value = 1.5708, axis = (1, 0, 0), constraint_axis = (True, False, False), constraint_orientation = 'GLOBAL')

    @classmethod
    def poll(cls, context):
        return context.mode == 'OBJECT' and context.area.type == 'VIEW_3D'

    def execute(self, context):
        self.FixRotationForUnity3D()
        return {'FINISHED'}

# fixes rotation on X and Z axis, front is now +Y
class UnityRotationFixerXZ(bpy.types.Operator):

    bl_description = "Fixes rotation of object, +Y is now front"
    bl_label = "Full rotation fix"
    bl_idname = "object.unity_rotation_fix_xz"
    bl_options = {'REGISTER', 'UNDO'}

    def FixRotationForUnity3D(self):
        bpy.ops.object.transform_apply(rotation = True)

        bpy.ops.transform.rotate(value = -1.5708, axis = (1, 0, 0), constraint_axis = (True, False, False), constraint_orientation = 'GLOBAL')
        bpy.ops.transform.rotate(value = -3.1416, axis = (0, 1, 0), constraint_axis = (False, True, False), constraint_orientation = 'GLOBAL')

        bpy.ops.object.transform_apply(rotation = True)

        bpy.ops.transform.rotate(value = 1.5708, axis = (1, 0, 0), constraint_axis = (True, False, False), constraint_orientation = 'GLOBAL')
        bpy.ops.transform.rotate(value = 3.1416, axis = (0, 0, 1), constraint_axis = (False, False, True), constraint_orientation = 'GLOBAL')
    @classmethod
    def poll(cls, context):
        return context.mode == 'OBJECT' and context.area.type == 'VIEW_3D'

    def execute(self, context):
        self.FixRotationForUnity3D()
        return {'FINISHED'}

class UnityPanel(bpy.types.Panel):

    bl_idname = "OBJECT_PT_unity_tools"
    bl_label = "Unity Tools"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_context = "objectmode"
    bl_options = {'DEFAULT_CLOSED'}

    def draw(self, context):

        layout = self.layout

        col = layout.column(align=True)
        col.label(text="Rotation:")
        col.operator("object.unity_rotation_fix_x")
        col.operator("object.unity_rotation_fix_xz")


#registers    

def register():
    bpy.utils.register_class(UnityRotationFixerX)
    bpy.utils.register_class(UnityRotationFixerXZ)
    bpy.utils.register_class(UnityPanel)

def unregister():
    bpy.utils.unregister_class(UnityRotationFixerX)
    bpy.utils.unregister_class(UnityRotationFixerXZ)
    bpy.utils.unregister_class(UnityPanel)

if __name__ == "__main__":
    register()

以及安装指南:

  

要安装此插件,请将其解压缩到Blender插件文件夹中,例如   “ C:\ Program Files \ Blender Foundation \ Blender \ 2.67 \ scripts \ addons”或   使用插件选项卡下用户首选项中的从文件安装按钮。

     

安装后,插件属于“对象”类别,启用后,   可以从“ Unity Tools”面板下的Tool Shelf中访问。

     

请注意,在X和Z轴上完全旋转固定将交换对象,因此   如果通过fbx导出,将面向+ Y轴而不是-Y,请记住   使用完整旋转固定时,将“正向Z”和“向上Y”设置为导出轴。

答案 1 :(得分:0)

Unity具有与3D Max(和Blender等)不同的轴,并修复了Unity默认情况下旋转模型的问题。只是Unity的东西。如果与您相邻,则始终可以将模型设置为空对象的子代。

答案 2 :(得分:0)

以最大3d的速度加载球,将其在x轴上旋转-90度,重置变换并重新导出。至于规模,

https://docs.unity3d.com/Manual/FBXImporter-Model.html

在检查器中选择模型并检查其属性,特别是导入道具。...做一些数学运算并调整导入比例。