x


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!!

more ▼

asked Nov 10 '10 at 12:46 AM

Heather gravatar image

Heather
97 5 5 12

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

1 answer: sort voted first

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;
   }
}
more ▼

answered Nov 10 '10 at 01:11 AM

Adam Rademacher gravatar image

Adam Rademacher
1.1k 1 3 19

(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:

x3419
x3127
x1019
x356
x292

asked: Nov 10 '10 at 12:46 AM

Seen: 4559 times

Last Updated: Nov 10 '10 at 12:46 AM