Forum Discussion
bobbiannedoerr
10 years agoHonored Guest
2 cameras in a scene issue
I have two cameras in the same scene. One is a 1st person and the one is 3rd person. I am trying to make it be like Resident Evil, where if you went through a door, the player will view a room through...
bobbiannedoerr
10 years agoHonored Guest
So here is the code I have for the camera switch. Is there something wrong with that?
#pragma strict
var cam1 : Camera;
var cam2 : Camera;
private var walkedIn : boolean = false;
function Start()
{
cam1.GetComponent.<Camera>().enabled = true;
cam2.GetComponent.<Camera>().enabled = false;
}
function OnTriggerEnter(Col : Collider)
{
if(Col.tag == "Player")
{
walkedIn = !walkedIn;
}
}
function Update()
{
if(walkedIn == true)
{
cam1.GetComponent.<Camera>().enabled = false;
cam2.GetComponent.<Camera>().enabled = true;
}
if(walkedIn == false)
{
cam1.GetComponent.<Camera>().enabled = true;
cam2.GetComponent.<Camera>().enabled = false;
}
}
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 7 months ago
- 2 years ago
- 2 years ago