- Home /
Applying a Proper Mesh Collider to a Blender Import
I have been creating some 3D elements using Blender and I can't seem to get the mesh collider setting right. My models will render in my scene, but the physics is applied incorrectly. When I apply a mesh collider to my model as one unit, the mesh appears to be rotated 90 degrees from the actual object. What should I do in order to create a mesh that fits my model? Should the collider be applied to the object as a whole, or to an individual part of the object? Any pointers on importing from Blender or just applying physics colliders to custom objects would be greatly appreciated.
Answer by DrSchuess · Feb 28, 2010 at 12:59 AM
I think I found a relatively easy way to fix the problem without having to go back into blender and re-positioning the object. When the asset is imported as a prefab, under the inspector expand the (FBXImporter) component. Checking the "Generate Colliders" box applies mesh colliders to the individual parts of the object, and the entire object has a new collider that is oriented correctly with its position.
One thing I have noted though is that my object still has a habit of falling through a created terrain, especially on an incline when the object is rolling and a narrower part of the object contacts the terrain. I think that this however is something different from my original problem, so it might be easily fixed by creating a thicker mesh. Can anyone check me on this?
That's what I told you to do. Is it really so hard to figure out that you should check "Generate Colliders" ins$$anonymous$$d of "$$anonymous$$eshes have colliders", which is what the option used to be called, and is still called in Unity iPhone?
You were not very specific in your explanation, Jessy, especially as to where this function might be located. Since that option no longer exists, it doesn't show up in the Unity search. This answer is much more specific.
hey soz i wasnt reading comments, i have a vid that should explain my way as good as i can explain it http://vimeo.com/9798695
Answer by Proportion 1 · Feb 27, 2010 at 11:14 AM
where is that import setting? EDIT i figured it out dood, when u bake the scale and rotation, it doesn't apply it the same direction aka 90degrees wrong. so go into blender and open up your problem object, rotate it 90 degrees in the opposite direction (if collider is facing down in unity, face it up in blender) then in the 3d view header, go object | clear/apply | apply scale/rot to obdata. after you have done that rotate your object back to its original position and save.
problem solved !!
(well it did for me any way heh)
Please note: You just made a comment to the previous answer by filling in a new answer. You should have responded to the previous answer with the 'add comment' text link.
I think I followed all of your instructions correctly but I couldn't get it to work for me. Should all the of the meshes be joined as one or is there anything else I might be missing?
Answer by Jessy · Feb 26, 2010 at 11:48 PM
Blender doesn't use the same axis convention as Unity. Why don't you just use the import setting, "Meshes have colliders"? That automatically orients the collider properly.
Where is this setting? I wasn't able to find it. Does it work regardless of the object's rotation in blender?
Are you talking about the "generate colliders" option under the (FBXImporter) menu of the imported prefab?
Answer by vipinsoni38 · Mar 13, 2020 at 04:36 AM
I think to make a new Prefab works. in my case, I imported objects from blender and then added its mesh models to my new GameObject and made a prefab then applied collider. worked for me :)