- Home /
when MainCamera enter a trigger
I want it so that when the main camera in the scene enters a trigger. And when inside i want a boolean to be set to true, and when the camera exits the boolean will be set to false. How would i do this?
Comment
Best Answer
Answer by Bravini · Oct 11, 2010 at 06:08 PM
you need to add a collider/trigger to your camera, then use a script to make the swith with the- function OntriggerEnter/OnColliderEnter { key = true; }
function OnTiggerExit/OnColliderExit { key = false }
Colliders stop at other colliders while triggers go through them, so usually triggers are better for cameras. To go for triggers only, add a collider and tick the checbox "trigger" on it.