I want to use my own mesh as a collider mesh but I read somewhere that unity can’t do that for normal objects? What is this? That’s very bad. How am I supposed to make a table with physics then?
Well since I am prone to ask Noob questions, guess I will field some in recompense.
Select your imported mesh. Then click on the menu Component-Physics-Mesh Collider, and your imported mesh will now be a collider.
On Edit, your meshes need to be marked convex if you want to to collide with each other.
Sure it can. You may have misunderstood; possibly what you read was that mesh colliders don’t collide with other mesh colliders, unless at least one of them is convex. You don’t normally want mesh colliders for moving objects anyway, but should use compound primitive colliders (a typical table would be 5 box colliders, for example).
–Eric
Convex makes my table have a cube collider. That’s not good.
Tell me more. I’d prefer to do that in an external application if possible and then import it. If not, tell how please
I’m not aware of any automated ways to generate compound primitive colliders, though no doubt it could be done with editor scripting. If you have empty game objects with nothing but a collider attached, and make them children of a rigidbody, then they behave as a single collider; the parent rigidbody will receive OnCollisionEnter messages and so on.
–Eric
Load the model up in blender. (Blender has a steep learning curve, but then so does every worth while modeler…) Add then draw cubes as individual objects over the different parts of the model, then export the whole thing as a fbx file (deselect export selected when you export) then you will have your table model, and primitives which you can simply apply the cube physics components to…
Then just make the physics models invisible in Unity… However, as I have been using unity just a couple of days, I don’t yet know how to do this, and I am being kicked off computer for evening
That’s a good point; when adding primitive colliders, they are automatically sized to the extents of the mesh. You can remove the mesh filter and mesh renderer components after adding the collider, so all you’re left with is the transform and collider components.
–Eric
Yes, there is an automated way to generate a compound collider for Unity3D