Most of the times I can use the Mesh Filter's mesh as collider in Mesh Collider

But sometimes there is just nothing. No collider. Why?

I used this free asset: https://assetstore.unity.com/packages/3d/environments/fantasy/green-forest-22762

The tree has no collider

enter image description here


The documentation says that when the object has a rigidbody, then the mesh assigned to the mesh collider must be convex. Your screenshot doesn't show whether or not there is a rigidbody on the object. But the mesh of this tree looks anything but convex and the convex checkbox on the mesh collider isn't set.

But when trees in your game don't move (as is the usual behavior of trees), you can mark your trees as "static" by marking the "Static" checkbox in the upper right corner of the inspector (unfortunately also not shown on the screenshot). They then no longer need a rigidbody themselves in order to block other rigidbodies and they can now have a non-convex mesh collider.

However, you should still consider to create simpler meshes for collision purposes. Having a large number of mesh colliders with a high number of polygons in the scene can be a real performance killer. And players rarely notice it when collision meshes are far less detailed than the meshes used for rendering. With trees it is in fact usually expected that the small branches and leaves aren't solid. Common practice for trees is to create colliders which only approximate the trunk and the largest branches.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.