不解

摄像机的调用,iPhone的震动调用 详解

http://away3d.com/livedocs/away3d/4.0/away3d/textures/WebcamTexture.html#dispose%28%29

//自由切换前后摄像头代码
string deviceName;
    string deviceName1;
    WebCamTexture WCT;
    int i;

    void Start () {
        WebCamDevice[] devices = WebCamTexture.devices;
        i = devices.Length;
        deviceName = devices[0].name;//获取主摄像机
        if (i == 2) {
            deviceName1 = devices[1].name;//获取副摄像机
        }
        //WebcamTexture(cameraWidth:uint = 320, cameraHeight:uint = 240, materialSize:uint = 256,
        //                    autoStart:Boolean = true, camera:Camera = null, smoothing:Boolean = true)
        WCT = new WebCamTexture(deviceName, 400, 300, 12);
        renderer.material.mainTexture = WCT;
        WCT.Play();
    }

    void OnGUI() {

                if (GUI.Button (new Rect (10, 10, 300, 60), "Vibrate")) {
                        Handheld.Vibrate ();
                }//调用手机震动

                if (GUI.Button (new Rect (10, 80, 300, 60), deviceName)) {
                        WCT.Stop ();
                        WCT = new WebCamTexture (deviceName, 400, 300, 12);
                        renderer.material.mainTexture = WCT;
                        WCT.Play ();
                }//调用主摄像头
                if (i == 2) {
                        if (GUI.Button (new Rect (10, 150, 300, 60), deviceName1)) {
                                WCT.Stop ();
                                WCT = new WebCamTexture (deviceName1, 400, 300, 12);
                                renderer.material.mainTexture = WCT;
                                WCT.Play ();
                        }//调用副摄像头
                }

        }


同步自网易博客 (查看原文)

评论