oldman

添加脚本位置

    First Person Controller: 添加CameraSwitch脚本

            下层物体 graphic

                        MainCamera

    AnimationCamera:从3dmax中导入,添加CameraSwitch脚本

             下层物体 camera  新建并作为子物体

cameraswitch代码:

var camera1 : Camera; 
var camera2 : Camera;
//var customskin : GUISkin;
private var programeGoon : boolean = true;

/*function Start(){

   programeGoon = true;
   //mouselook1 = GetComponent("mouseCameraCsharp");

}*/
function Update () {
     if(programeGoon)
  {
     camera1.enabled = true;
        camera2.enabled = false;
  programeGoon = false;
  }
     var fpswalker : FPSWalker = GetComponent(FPSWalker);
     var mouseControl = GetComponent("RightMouseControl"); 
     if(camera1.enabled)
     {
  mouseControl.enabled = true;
  fpswalker.enabled = true;
  }
  if(!camera1.enabled)
 {
  mouseControl.enabled = false;
  fpswalker.enabled = false;
 }
}
function OnGUI () {
//GUI.skin = customskin;
GUI.Box (Rect (10,10,100,90), "Camera Switch");

// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
if (GUI.Button (Rect (20,40,80,20), "Camera 1")) {
  camera1.enabled = true; 
        camera2.enabled = false; 
}
// Make the second button.
if (GUI.Button (Rect (20,70,80,20), "Camera 2")) {
  camera1.enabled = false; 
        camera2.enabled = true; 
}

}


}

分类:

技术点:

相关文章:

  • 2022-01-06
  • 2021-07-24
  • 2021-08-24
  • 2022-01-18
  • 2021-09-24
  • 2021-04-10
  • 2021-05-09
  • 2021-11-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案