- Home /
Is Trigger Collision Problem
So when my rigid body character jumps onto a box that has "Is Trigger" unchecked, it collides with the box and can stay on top of the box. But when I switch "Is Trigger" to be checked, my character moves right through the box, it seems that the box loses its collider. Is there a way to keep the collider and have "Is Trigger" checked? I want my character to stay on the box for 2 seconds then have the box be destroyed using OnTrigger function, but it does't collide with the box when "Is Trigger" is checked.
Answer by testure · Jul 02, 2011 at 01:44 AM
That's the whole point of a trigger. If you want 'triggered' functionality but still have collision, don't mark it as a trigger and use the OnCollisionEnter method to perform whatever triggered behavior you're looking for:
http://unity3d.com/support/documentation/ScriptReference/Collider.OnCollisionEnter.html
Wow, thanks I didn't think of that, I'm pretty new to unity.
Yeah, triggers are used specifically when you don't want any collision- or want to handle the collision manually. For example, you could use a trigger to spawn enemies when the player enters a certain zone, or you could trigger an event or cutscene to happen, etc.
And technically, a collider is just a trigger than has collision detection code built-in. Sometimes you'll want very very simple collision detection, and can simplify the behavior by setting it as a trigger and handling it yourself.
Lots of options.
Your answer
Follow this Question
Related Questions
Physics Possibilities?: Angles, Penetration, Exceptions 4 Answers
A Collider problem. 1 Answer
Rigidbody bounce or character controller istrigger issues 0 Answers
Is Triggered Collider Issue 1 Answer