Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Find and turn off previous camera?

$
0
0
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; } }

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>