【问题标题】:Scale and Rotation Issue with Model Import 3DS Max to Unity模型导入 3DS Max 到 Unity 时的缩放和旋转问题
【发布时间】:2019-02-24 13:12:05
【问题描述】:

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

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

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

给我一​​些建议。

【问题讨论】:

    标签: unity3d 3dsmax 3ds


    【解决方案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 轴上的完整旋转修复将交换对象,因此它 将面向 +Y 轴而不是 -Y,如果您通过 fbx 导出,请记住 使用全旋转修复时,将 Forward Z 和 Up Y 设置为导出轴。

    【讨论】:

      【解决方案2】:

      Unity 具有与 3D Max(和 Blender 等)不同的轴,并且修复了 Unity 默认旋转模型的问题。只是团结的事情。如果它与您接壤,您始终可以将模型设置为空对象的子对象。

      【讨论】:

      • 好的,谢谢您的回复,但是我需要在 3ds max 中做什么?这样模型就可以在 Unity 中正确导入 - 我对那个侧面解决方案更感兴趣,这样编程方式就不会受到影响。
      • 您可以在 3D Max 中旋转它。但这太过分了,您可能应该保持原样。这是 Unity 的官方解决方案
      【解决方案3】:

      在 3d max 中加载球,在 x 轴上旋转 -90 度,重置变换并重新导出。至于尺度,

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

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

      【讨论】:

        猜你喜欢
        • 2013-07-13
        • 1970-01-01
        • 2012-03-29
        • 2012-11-02
        • 1970-01-01
        • 1970-01-01
        • 2019-07-17
        • 1970-01-01
        • 2011-11-12
        相关资源
        最近更新 更多