G'day guys, I have a simple question regarding one use of colliders.
I'm drawing up plans for a third-person project, where the player will explore an indoor environment, filled with rooms and hallways. I'd like to create empty gameobjects with box colliders, behaving as triggers, so that I can track which section of a level the player is in, so that I can trigger events.
My only question is this: how much does a collider employed in this manner affect performance? If I used OnTriggerEnter/Exit, it could be as simple as two events code-wise, but I thought I'd see if anybody else uses them for this kind of purpose.
asked Jun 28 '12 at 07:06 AM
I you use static triggers, the performance overhead would be minimal. If you plan to make these triggers move, then add a kinematic rigidbody on it. Otherwise, don't forget to mark them as static.
I used it a lot in a car racing game where the road was generated on the fly (each trigger would "trigger" the generation of another piece of road). And this even worked fine on mobile.
answered Jun 28 '12 at 07:48 AM