#Tree Collision detection on Terrain Painted Trees

1 messages · Page 1 of 1 (latest)

marble violet
#

anyone help

marble violet
#

?

fiery spindle
#

i dont think you can

marble violet
#

hmm

fiery spindle
#

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

marble violet
#

İ want prevent to building campfire inside the trees

#

how can i achive that?

fiery spindle
#

i am out of here bye

#

i cant help with that

queen saffron
#

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

marble violet
queen saffron
#

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

marble violet
#

Because when i click to the terrain, so mesh of the orange outline covers the trees too, it looks 1 mesh

queen saffron
#

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