x


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?

more ▼

asked Oct 11 '10 at 05:27 PM

Mattias gravatar image

Mattias
30 3 4 6

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Oct 11 '10 at 06:08 PM

Bravini gravatar image

Bravini
1.1k 6 11 29

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2996
x982
x240

asked: Oct 11 '10 at 05:27 PM

Seen: 925 times

Last Updated: Oct 11 '10 at 05:27 PM