I'm having trouble with my terrain trees! When ever I use the Terrain Tree Painter thing, it always makes them so I can walk through them. on the terrain collider script thing I have "Create Tree Colliders" on but STILL, I also have Generate Colliders on the tree I'm using (I'm using the Palm tree that comes with Unity, its in that occular-somethingorrather folder still), and its really annoying. I dont want to have to manually put each tree in the right place because I have a lot of trees!!!
The "create tree colliders" option doesn't work quite like that. Instead, you may want to add a capsule-collider manually by following these steps:
Find the tree you want in the Project panel.
Drag it out as a prefab onto your map. (It doesn't matter where, just so you can see it)
Select the tree, and in the Components menu, under Physics, add a capsule collider.(Losing the prefab is OK.)
Set the radius of the collider to between 0.8 and 1. Make sure the height is about 20.
Make a new prefab and call it `Palm(Collider)` and drag your new tree into it.
Under terrain tree painter add the tree called `Palm(Collider)`.
Place a few trees, and you should be ready to go!
Press play, and the trees should now have colliders. If you want more trees and terrain textures, there is a great collection available for download here. Good luck!
Adding a capsule collider is better then adding one that is a cylinder in most engines due to the fact that the end-caps on a capsule use the same radius as the radius of the body, so that the math is easy to compute collision by then engine. Adding a collider that is in the form of a cylinder makes the math much more intensive since the ends are flat, thus more expensive in processing time. If you are adding colliders to a large amount of assets in your scene then it is best to use capsules and not cylinders since the additive processor load is considerably greater for the cylinders and will tend to add to problems like lag.
The tree model should have a collider added, best is to add a cylinder-collider manually.
The capsule collider thingy does not work for me. I placed one tree, made a capsule collider and put it in to the tree painter. The ones i place manually are working, but the ones i place with the Tree painter dont, i just walk through them AND if i want to save the scene the trees placed with the painter disappear and are marked as “missing”
I see there is already a correct answer, for the sake of future references you need colliders for anything that you want your character to no walk into, or any other game object on screen. Some meshes will create them automatically and its a case of implementing them onto your model.
component -> physics -> mesh collider
This option will create a collider the exact size of the mesh you have selected from the inspector. Otherwise you will need to add a custom sized one to your model.
component -> physics -> capsule/sphere/box/wheel collider