Tree colliders not working

Hey all!

I’m pretty new to Unity, I’ve been following the book ‘Unity Development Essentials’ as part of preparation for my final year University project for which I intend to use Unity.

I’ve been having trouble with the tree colliders - as in, they don’t work. I’ve ensured that the terrain isn’t set to a trigger and that tree colliders is enabled but it just doesn’t seem to want to work.

Any ideas?

Hi,
you’ve probably used the palm tree prefab? that comes with the standard assets, check if the prefab has a collider, if it doesnt add one, and then use the tree. You could also use any other mesh with collider as a tree and check.

Hmm, I’ve tried adding a mesh collider and it works while I have the tree just ‘there’ in the game world as an independant object, but as soon as I prefab it and import it as a tree it stops working again. I’ll try tonight with a few different object types to see if I can get colliders to work that way incase I’m doing something wrong - then post back here.

I am having this same problem. Took the palm tree, added a mesh collider, created a prefab with it. Imported it in the terrain, and mass place tree with it. And the collider seems not to work. If I place the prefab directly in the terrain, the tree collider is just working!

I am running Unity 3.3, free edition! And yes, I have the “Create Tree Collider” check box checked. Anyway, it has the same behavior with or without it being checked.

Thank you for any hint.

It seems that if the collider is not a mesh collider but, for instance, a capsule collider, it works. Would like an “explanation” why.

1 Like

I’ve

  1. placed a tree prefab in my scene
  2. added a mesh collider
  3. made a new prefab out of this new GameObject
  4. loaded that into my terrain script
  5. placed couple of trees in my scene using the terrain tree painting stuff

and collision worked fine :slight_smile:

-------------------------Edit-------------------------
I was wrong, placing them with the terrain script, the collider isn’t working anyways -.-

They talking about mass place tree option by selecting it from terrain menu iSaacX
it doesn’t work for me as well , if I need a tree that I can collide with I have to add it manually in the scene
when using mass place , not a single tree of the mass have collide

we need some feedback here please

ty

I am not getting collisions with the trees and I can’t add a collider to the tree object either.

hey i try to attach mesh collider but dont want work, then i try to attach capsule collider and work it :slight_smile: wth why mesh collider dont work? :rage:

hey guys

same issue as the others…I tried the prefab adding of capsule, but when ever it is painted on the terain, it always seems to revert to not colliding.

Also, unity wants to crash if you try to do this more than once (probably not related?)

Any help with this would be great, thank you

Penna is right. I don’t know why, but Capsule Collider works as part of terrain, and Mesh Collider doesn’t. Perhaps because as part of terrain, they lose their individual mesh and get merged into one?

1 Like

I want in on this, even though it’s old. Why don’t massed placed trees with colliders work? I mean, I can place it all myself, but it’ is confusing for new people.

Like me.

I notice that this post is a bit old. Now it is 2016 and this problem has not been solved by anyone. It is quite sad. Maybe someone will find a solution … maybe … I have the same problem and unfortunately I don’t have a solution.

Hi Danteneo

Not sure if you still need this, but I struggled with the same thing and found a solution on a different blog.

What I did after my script placed the trees is this:

terrain.GetComponent ().enabled = false;
terrain.GetComponent ().enabled = true;

Not sure what bug in unity is causing this… But this fixed it for me and a few others.

If you place prefabbed trees (with mesh collider) directly, without using the terrain brush, then they work fine. It takes longer but they do work.

Other things to know here are:

Mesh colliders wont collide with other mesh colliders unless they are convex. Which is an option in the mesh collider component.

Mesh colliders need not be convex if they are only going to be hit by primitive colliders (Sphere, Cube, Cylinder etc).

Unity Version - 2019.4.12f1