I want to make some changes to my fixed camera script. it is a trigger that chooses to use the camera attached, then upon exiting the camera is deactivated. I have many cameras with these trigger scripts in my scene. What I'd like to do is this: Instead of deactivating the current camera upon exit, at the moment the current camera is set to enabled true I then want to find the previous camera that was in use and deactivate THAT. I hope this makes sense.
Thanks in advance.`
var gameCamera : GameObject;
private var inSide : boolean = false;
function Start()
{
}
function OnTriggerStay(Col : Collider)
{
if(Col.tag == "Player")
{
inSide = true;
}
}
function OnTriggerExit(Col : Collider)
{
if(Col.tag == "Player")
{
inSide = false;
}
}
function Update()
{
if(inSide == true)
{
gameCamera.GetComponent.().GetComponent.().enabled = true;
}
if(inSide == false)
{
gameCamera.GetComponent.().GetComponent.().enabled = false;
}
}
↧