简体   繁体   English

Blender在Unity中导入,如何生成正确的网格碰撞器?

[英]Blender import in Unity, how to generate correct mesh collider?

统一捕获

How to get/generate a proper mesh collider in Unity using a model exported from Blender (.obj/.fbx)? 如何使用从Blender(.obj / .fbx)导出的模型在Unity中获取/生成适当的网格碰撞器?

This is my second day using Blender and I'm hitting a roadblock. 这是我使用Blender的第二天,但遇到了障碍。 I've tried fiddling with the Rigid Body Collisions, ie, setting "Shape" to Convex Hull and "Source" to Final/Deformed (Blender docs specify that these two settings capture modifiers), I've tried "Generate Colliders" inside Unity and the mesh collider always comes out as above. 我尝试摆弄刚体碰撞,即将“形状”设置为凸包,将“源”设置为最终/变形(Blender文档指定这两个设置捕获修改器),我尝试在Unity中进行“生成碰撞器”而且网状对撞机总是如上所述出现。 A box. 一个盒子。

How to assign mesh collider to the exact mesh? 如何将网格对撞机分配给确切的网格? I started with a circle and used a boolean modifier to create the cutout. 我从一个圆圈开始,并使用布尔修改器创建了一个切口。 Desire is to have the mesh collider around the mesh exactly, meaning no collider on the cutout. 希望使网格碰撞器精确地围绕网格物体,这意味着切口上没有碰撞器。 How to do this? 这个怎么做?

Make sure you have a Mesh Collider component on your object with the correct mesh set. 确保您的对象上具有正确的网格集的Mesh Collider组件。 Watch out for the convex parameter for flat objects, as it can sometimes fail and give you a box collider instead. 注意平面对象的凸参数,因为它有时可能会失败,而是给您一个盒子对撞机。

屏幕截图示例

Edit: 编辑:

I just noticed you said you were using a RigidBody, which means you need to have Convex set. 我刚刚注意到您说您正在使用RigidBody,这意味着您需要设置Convex A solution to this is to make a second mesh in Blender with a third dimension to it, then set the flat one on the Mesh Filter and the one with thickness to the Mesh Collider . 一种解决方案是在Blender中制作第二个网格,使其具有第三个尺寸,然后在“ Mesh Filter上设置平坦的Mesh Filter ,然后将其厚度设置在“ Mesh Collider

In importing a .obj or a .fbx , select the asset. 在导入.obj.fbx ,选择资产。 make sure you have generate colliders selected. 确保已选择generate colliders

Here I have imported an FBX into unity, but there are no colliders. 在这里,我已将FBX导入为统一体,但没有对撞机。 在此处输入图片说明

Sellect the asset, and turn on generate colliders if you want a collider around the mesh: 卖出资产,如果要在网格物体周围放置generate colliders ,请打开generate colliders

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM