// Use this for initialization
    void Start()
    {
        #if UNITY_EDITOR || UNITY_STANDALONE_WIN
        switch (deviceTypeIndex)
        {
        //Auto selection
        case 0:
            virtDevice = getStandardVirtualizerDevice();
            if (virtDevice == null)
            {
                fallbackToStandardCoupled();
                return;
            }
            break;

        //Standard de-coupled virtualizer input
        case 1:
            virtDevice = getStandardVirtualizerDevice();
            break;

        //TODO: Standard coupled movement input
        case 2:
            fallbackToStandardCoupled();
            return;

        //Faild to find VirtDevice
        default:
            break;
        }
        #endif

        #if UNITY_ANDROID
        virtDevice = new CVirtDeviceBluetooth();
        #endif

        if (virtDevice != null)
        {
            CLogger.Log("Virtualizer device found, connecting...");

            if (virtDevice.Open())
            {
                CLogger.Log("Successfully connected to Virtualizer device.");

                //Reset ResetPlayerOrientation and PlayerHeight
                virtDevice.ResetPlayerOrientation();
                virtDevice.GetPlayerHeight();
            }
            else
            {
                CLogger.LogError("Failed to connect to Virtualizer device.");
            }
        }
        else
        {
            CLogger.LogError("Virtualizer device not found...");
        }
    }
    // Update is called once per frame
    void Update()
    {
        float playerHeight = 0.0f;

        if (deviceController != null)
        {
            CVirtDevice virtDevice = deviceController.GetDevice();
            if (virtDevice != null)
            {
                // Get Virtualizer raw inputs
                /////////////////////////////
                Vector3 virtOrientation = virtDevice.GetPlayerOrientation();
                float   virtHeight      = virtDevice.GetPlayerHeight();
                Vector3 virtDirection   = virtDevice.GetMovementDirection();
                float   virtSpeed       = virtDevice.GetMovementSpeed();

                // Turn
                ///////
                Quaternion rotation = new Quaternion();
                rotation.SetLookRotation(virtOrientation, Vector3.up);
                forwardDirection.localRotation = rotation;

                // Hip Height
                /////////
                playerHeight = virtHeight / 100.0f;

                // Move Character
                /////////////////
                if (virtSpeed != 0.0f)
                {
                    virtSpeed = virtSpeed * movementSpeedMultiplier;

                    if (characterController != null)
                    {
                        this.characterController.SimpleMove((forwardDirection.TransformDirection(virtDirection)).normalized * virtSpeed);
                    }
                }
            }
        }

        if (useProfileHeight)
        {
            if (initialPose == null)
            {
                initialPose = new OVRPose()
                {
                    position    = cameraController.transform.localPosition,
                    orientation = cameraController.transform.localRotation
                };
            }

            var p = cameraController.transform.localPosition;
            p.y = (OVRManager.profile.eyeHeight - 0.5f * characterController.height) + playerHeight;
            p.z = OVRManager.profile.eyeDepth;
            cameraController.transform.localPosition = p;
        }
        else if (initialPose != null)
        {
            cameraController.transform.localPosition = initialPose.Value.position;
            cameraController.transform.localRotation = initialPose.Value.orientation;
            initialPose = null;
        }
    }