|
I am having trouble getting the trees on my terrain that has "Create Tree Colliders" checked to work as functioning colliders. I am using Physics.CheckSphere now to determine if another collider is inside the position of an object I am trying to place only if there is nothing in the way. This works just fine for other objects that have colliders, but for some reason I can place the buildings right over any trees on my terrain. I know my Sphere is large enough because I have tried making the sphere cover the whole terrain, but Physics.CheckSphere still does not return true. I have tried a layermask for everything, just the terrain, just the default layer, and nothing, but none of them will get the trees to be in the way. All the buildings work just fine and can not be built on top of eachother, so I am not sure what the problem is. Also, I am using the trees that come in the resource package from the Unity website. Any help with this issue would be great, thanks!
(comments are locked)
|
|
I just checked this, and I cannot replicate the behavior you are describing. CheckSphere does work with Tree Colliders. Are you sure the tree colliders are actually created? Does anything else collide with them? Tree colliders are only created when the prefab used as a tree prototype has a Capsule Collider component. Hmm... maybe the trees I am using do not have a Capsule Collider in the prefab. They are just the trees that come with Unity and the Tree pack in the Resources from the Unity site. Oh, and nothing else collides with the trees but the check on the terrain is checked.
Jan 28 '10 at 12:09 AM
Brian 1
Yup, that is correct. The palm tree which comes with standard assets will not collide as is. Make a new prefab with that tree, and add a capsule collider. Use that as a tree prototype and everything should work as expected.
Jan 28 '10 at 09:23 AM
jonas echterhoff ♦♦
(comments are locked)
|
|
Hey I figured out what's wrong. You have to add a tree mesh to the stage, add a capsule collider component, then make it a new prefab. Click on your terrain and replace the trees with the new prefab :) voil! Thanks! I don't like walking through trees. :)
Aug 02 '10 at 09:51 PM
BinaryCaveman
(comments are locked)
|
|
I add a capsule collider to the tree prefab then add it to the terrain and my unity crashes :(
(comments are locked)
|
|
this is happening to me also. I walk through trees :(
(comments are locked)
|
