- Home /
Colliding with trees using mesh colliders
I have trees on my terrain that were generated through the tree brush tool. I have "Create tree colliders" checked and my trees all come from a prefab with a mesh collider on it. However, you can still walk through the trees. If I change the collider on the trees to a capsule collider, it works. Also, if mesh colliders simply aren't accepted, which ones are?
Answer by Tseng · Jul 10, 2011 at 03:19 AM
Only "convex" mesh colliders block/collide with ridigbodies (i.e. your player character).
You can check the "Convex" option to enable it.
http://unity3d.com/support/documentation/ScriptReference/MeshCollider-convex.html
You should use convex Mesh colliders only when you need precise collision detection, otherwise use the primitive ones as they get you better performance
i selected "Convex" on my pre-fab tree and it still doesn't work.. http://forum.unity3d.com/threads/127608-Tree-$$anonymous$$ESH-collider-issue-with-prefabs , help :<
Use capsule collider
http://docs.unity3d.com/Documentation/Components/terrain-Trees.html
Setting up Tree Collisions
If you'd like your trees to make use of colliders, it's very easy. When you've imported your Tree asset file, all you need to do is instantiate it in the Scene View, add a Capsule Collider and tweak it, and make the GameObject into a new Prefab. Then when you're adding trees to your Terrain, you add the tree Prefab with the Capsule Collider attached. You can only use Capsule Colliders when adding collisions with trees.
Your answer
Follow this Question
Related Questions
Tree Colliders Not Working With Physics.CheckSphere / Capsule 4 Answers
How do i prevent an imported Mesh from falling through Terrain? 3 Answers
colliders moving in wind 1 Answer
3rd Person Physics not working? 1 Answer
Returning list of Triangles, Vertices or Points by raycasting through a mesh (iPhone) 1 Answer