- Home /
Question by
richardzzzarnold · Nov 21, 2011 at 01:12 PM ·
multiplecamerascrossfade
CrossFade between multiple cameras
I am trying to adjust CrossFadePro.js into a version for multiple cameras but am not sure if it possible. So far I have made it like this (using ScreenWipes.js as well of course) ..It looks like it is almost working Any suggestions on how i can make it work?
var camera1 : Camera;
var camera2 : Camera;
var camera3 : Camera;
var camswitch1 : boolean;
var camswitch2 : boolean;
var aaa: float;
var customButton : GUIStyle;
var fadeTime = 2.0;
private var inProgress = false;
private var swap = false;
function OnGUI() {
if(GUI.Button(Rect(Screen.width/aaa-Screen.height/22,Screen.height/1.3,Screen.height/20,Screen.height/20),"",customButton))
choose();
}
function choose()
{
if((camswitch1==true)&&(camswitch2==true))
{
fade1();
camswitch2=false;
}
else if ((camswitch1==true)&&(camswitch2==false))
{
fade2();
camswitch2=false;
}
else if ((camswitch1==false)&&(camswitch2==false))
{
fade3();
camswitch1=true;
camswitch2=true;
}
}
function fade1 () {
if (inProgress) return;
inProgress = true;
swap = !swap;
yield ScreenWipe.use.CrossFade (swap? camera1 : camera2, swap? camera2 : camera1, fadeTime);
inProgress = false;
}
function fade2 () {
if (inProgress) return;
inProgress = true;
swap = !swap;
yield ScreenWipe.use.CrossFade (swap? camera2 : camera3, swap? camera3 : camera2, fadeTime);
inProgress = false;
}
function fade3 () {
if (inProgress) return;
inProgress = true;
swap = !swap;
yield ScreenWipe.use.CrossFade (swap? camera3 : camera1, swap? camera1 : camera3, fadeTime);
inProgress = false;
}
Comment
Answer by bingont · Feb 01, 2012 at 09:12 PM
i am working on a similar script. i tried modifying your script to toggle camera views on space matching the crossfade example. it seems to work but i think the problem lies with camera depth values. so now i am trying to figure out how the screen wipe script is manipulating the camera depth values. if you have already figured that out please let me know, i would really appreciated.