- Home /
Change main Camera to another camera with a Trigger then back with a Timer.
I'd like to turn off the main camera on the player, then switch to a separate static camera with a Trigger that the player would walk over.
I've seen alot of switching camera scripts, but all with "Input.GetKeyDown".
I figure a timer would work that would be as long as the video i have on a plane, but to go back to the main camera as well.
Any help would be appreciated. Thanks!!
Answer by Adam Rademacher · Nov 10, 2010 at 01:11 AM
From as best I can tell this script should point you in the right direction. You'll have to assign camera 1 and camera 2 and the movie texture in the scene when you attach the script to something that has a collider set to be a trigger.
var camera1 : Camera; var camera2 : Camera; var movie : MovieTexture; private var isPlaying : Boolean = false;
function OnTriggerEnter(other : Collider) { if(other.CompareTag("Player")) { camera1.enabled = false; camera2.enabled = true; StartMovie(); } }
function StartMovie() { if(!movie.isPlaying) { movie.Play(); isPlaying = true; } }
function Update() { if(isPlaying && !movie.isPlaying) { camera1.enabled = true; camera2.enabled = false; isPlaying = false; } }
Your answer
Follow this Question
Related Questions
Camera Scripts 1 Answer
Enable/Disable script with timer 1 Answer
End Game when hit's water 2 Answers
How to add 5 seconds to Timer that is counting DOWN OnTriggerEnter2d? 1 Answer
Controller Collider Script 1 Answer