#Tree Collision detection on Terrain Painted Trees
1 messages · Page 1 of 1 (latest)
?
i dont think you can
hmm
i tried it but it considers it as a part of terrain so you cant use the on collisionenter to detect when player collides wiith terrain
ooh thats a diffrent thing
i am out of here bye
i cant help with that
I would place the trees manually
place prefabs of them and mark them as static
the tree painting in unity is really limiting
I think I remember there being a script somewhere on the internet that autospawns the prefabs where the trees are in the terrain, effectively replacing them
you could google around for that
But I would just place them
Bur in this case there will be lots of tree colliders.. İt will damage to performance as fps
Creating them with colliders in the terrain will create lots of colliders too 😄
Both solutions will result in colliders
the difference is that using tree colliders just will not work because of the limitations
Try it and profile the performance difference, I imagine it wont be as big as you imagine
If you use capsule colliders the performance be just fine, and there really isnt much of a choice regardless
No, creating with terrain paint tool only creates one big mesh with trees in it as i know
Because when i click to the terrain, so mesh of the orange outline covers the trees too, it looks 1 mesh
Yep but just because they batch the vertices in the mesh doesnt mean that the physics system only has to do 1 collision check
There still is a ton of work done to determine which vertices of the tree you've hit
What you see rendered and what the physics system sees to detect and resolve collisions can be very very different
How many trees are you working with?
But I really urge you to try replacing them with some prefabs with capsule colliders and just benchmark it.
Ive done this sort of test before, I ran into the same issue once. The performance difference is not large. You are missing a lot of fundamental information in relation to physics systems and how collision testing works. Doing mesh collision is incredibly costly, and testing capsules against your player capsule is considerably cheaper, and when unity subdivides the physics test areas with an octree the cost of it goes down a lot