- Home /
Is it fine to use a separate quad for collision on a sprite?
I'm using tree sprites for terrain scenery and I would like to be able to collide with them. However, I want to be able to walk through the leaves, and collide only with the trunk. My workaround is to just have an invisible quad in the same spot as the trunk for collision. If my scene were to have hundreds/thousands of trees, would this negatively influence performance to have an extra quad per tree?
Thanks!
Answer by Harinezumi · Apr 05, 2018 at 08:52 AM
Separating visual model and physical model is a good idea. For example, you can have elements that render the tree trunk and others the leaves, then have a collider on the same element as the trunk just for collisions. You don't even need the invisible quad part, just the collider.
As for performance impact, yes, everything has a performance impact, but if you want to be able to collide with an object, you will need a collider. It is another question that you can disable objects that are not visible or not relevant to the current situation, improving performance.
Thanks, great answer! I kinda looked into it a bit more and was co$$anonymous$$g to the conclusion that I can't really get around using a collider. I'm not very experienced with Unity, so I didn't know if I was doing something wrong. Thanks a bunch.
Your answer
Follow this Question
Related Questions
Sprite based leaves of normal tree leaves? 0 Answers
Remove Trees during runtime 1 Answer
Tree collision 1 Answer
Why is CapsuleCast/Raycast performance effected by rigidbody? 1 Answer
Collision Killing CPU/FPS/Performance - Suggestions?! 0 Answers