Hey,
Im wondering how do you switch to another camera whilst playing.
if you could write me a script that would help a lot.
Thanks
Hey,
Im wondering how do you switch to another camera whilst playing.
if you could write me a script that would help a lot.
Thanks
Camera1.enabled = false;
Camera2.enabled = true;
what renman3000 meant was something like this this I believe
var camera1 : Camera; //Have to set a variable for your camera if you have more than one
var camera2 : Camera; //Have to set a variable for your camera if you have more than one
function Start(){
camera1.enabled = true; //when this script is first run camera 1 is on
camera2.enabled = false; //when this script is first run camera 2 is off
}
function Update(){
//make a if statement if you want a condition to control the camera toggle
if(your condition is true/false){
CameraToggleOnOff();
}
}
//just toggles the true and false values of the variables
function CameraToggleOnOff(){
camera1.enabled = false;
camera2.enabled = true;
}
Im Getting Heaps Of Errors
Here’s something that’s a little more basic if your just getting the hang of Javascript
this assumes you change CamNum to change camera
var camera1 : Camera;
var CamNum : float = 1; // if the number is one Camera one is enabled , if its 2 Camera two is enabled
var camera2 : Camera;
function Update(){
if( CamNum == 1){
camera1.enabled = true;
camera2.enabled = false;
}
if( CamNum == 2){
camera1.enabled = false;
camera2.enabled = true;
}
}
For now just change it in the inspector . Later add some code in this script to change CamNum from 1 to 2 .
This should compile no problem .