- Home /
Camera does not trigger OnTriggerEnter-event
Maby this sounds stupid, but what on earth do I have to do to make my camera trigger the OnTriggerEnter-function I have set up in my collider?
my camera is the main camera with a little script for rotation/panning/zooming quite similar to the controls in the 3D-view.
I have set up a trigger-zone (a simple box) with box-collider set to "is trigger" and with an OnTriggerEnter script attached.
the trigger-zone itself works if I use the predefined first-person-controler
the trigger-zone does NOT work with my simple custom camera
I have tried to attach a box-collider to the camera, but it didn't work. Setting the cameras collider to "is trigger" didn't work either. What am I missing?
Answer by whydoidoit · Jul 12, 2012 at 01:58 PM
One party in a collision must have a rigidbody attached to it. That rigidbody can has isKinematic = true set.
Thanks! That was the thing that's been missing. However, I found that assigning a rigidbody to the trigger-zone doesn't work. It only ever works when I attach it to the camera! So it seems to be important which party you apply it to after all...
I converted your answer to a comment.
Good point on the rigidbody - the thing with the rigidbody is the thing that gets the call (only one needs it, but the other won't be called).
Your answer
Follow this Question
Related Questions
OnTriggerEnter fails to activate 1 Answer
Detect more than one collider trigger 2 Answers
Inconsistent behaviour in child triggers 1 Answer
Can't get trigger to work 1 Answer
Can't figure out how to use multiple triggers in single scene 1 Answer