# Tree collision (395823)

**URL:** https://discussions.unity.com/t/tree-collision-395823/395823
**Category:** Physics
**Tags:** Scripting
**Created:** [August 2, 2009, 10:51pm UTC](https://discussions.unity.com/t/tree-collision-395823/395823 "2009-08-02T22:51:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![anon\_21519246](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@anon\_21519246](https://discussions.unity.com/u/anon_21519246)
#### Post date: [August 2, 2009, 10:51pm UTC](https://discussions.unity.com/t/tree-collision-395823/395823/1 "2009-08-02T22:51:24Z")

</div>

Hi,

I can’t get the tree collision to work. I’m using a player controller and the move function and collision is working fine against static meshes and against some capsules that I’m using. But even if we can see the tree colliders (capsules) in the prefab it won’t work when in game. Any ideas?

//ohm

---

<div class="post-metadata">

### Author: ![anon\_78165414](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@anon\_78165414](https://discussions.unity.com/u/anon_78165414)
#### Post date: [August 3, 2009, 4:49am UTC](https://discussions.unity.com/t/tree-collision-395823/395823/2 "2009-08-03T04:49:42Z")

</div>

Select your terrain and make sure that “Create tree colliders” is checked in the properties tab.

---

<div class="post-metadata">

### Author: ![EmadGh](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/emadgh/32/219869_2.png) [@EmadGh](https://discussions.unity.com/u/EmadGh)
#### Post date: [August 3, 2009, 6:45am UTC](https://discussions.unity.com/t/tree-collision-395823/395823/3 "2009-08-03T06:45:30Z")

</div>

You must put your tree in a new prefab and make a collider for it.I think capsule collider is use full for this.

---

<div class="post-metadata">

### Author: ![anon\_21519246](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@anon\_21519246](https://discussions.unity.com/u/anon_21519246)
#### Post date: [August 3, 2009, 6:46am UTC](https://discussions.unity.com/t/tree-collision-395823/395823/4 "2009-08-03T06:46:22Z")

</div>

The “Create Tree Colliders” checkbox is checked. We are loading the terrain from script with code locking something like this:

```auto
TerrainData terrainData = (TerrainData)Resources.Load(path, typeof(TerrainData));
GameObject terrain = Terrain.CreateTerrainGameObject(terrainData);

```

Would that matter?

//ohm

---

<div class="post-metadata">

### Author: ![anon\_21519246](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@anon\_21519246](https://discussions.unity.com/u/anon_21519246)
#### Post date: [August 3, 2009, 7:42am UTC](https://discussions.unity.com/t/tree-collision-395823/395823/5 "2009-08-03T07:42:39Z")

</div>

This is how we are doing:

1. Create new prefab
2. Setup mesh, materials and stuff
3. Add capsule collider
4. Use as a tree in the terrain editor

What have I missed? Should I make one prefab with just the mesh and then another based on that one with a collider?

//ohm

---

<div class="post-metadata">

### Author: ![EmadGh](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/emadgh/32/219869_2.png) [@EmadGh](https://discussions.unity.com/u/EmadGh)
#### Post date: [August 3, 2009, 7:58am UTC](https://discussions.unity.com/t/tree-collision-395823/395823/6 "2009-08-03T07:58:21Z")

</div>

that’s right.

---

<div class="post-metadata">

### Author: ![muso56](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@muso56](https://discussions.unity.com/u/muso56)
#### Post date: [August 31, 2009, 4:23pm UTC](https://discussions.unity.com/t/tree-collision-395823/395823/7 "2009-08-31T16:23:02Z")

</div>

we discovered if you programatically alter the location of the terrain the tree colliders no longer work… if the trees were created when the terrain was at 0,0,0 and the terrain remains at 0,0,0 they work otherwise you have to **move the terrain THEN create the trees**. Moving the terrain after the trees are created will turn off the colliders (perhaps they retain their original location …i dunno)
