Example #1
0
 /// <summary>
 /// Set the handness.
 /// </summary>
 /// <param name="hand">UserHandNess</param>
 public static void UPvr_SetHandNess(Pvr_Controller.UserHandNess hand)
 {
     if (System.UPvr_GetPvrHandnessExt() != (int)hand)
     {
         System.UPvr_SetPvrHandnessExt((int)hand);
         Pvr_Controller.ChangeHandNess();
     }
 }
Example #2
0
    void Start()
    {
#if OCULUS
        m_CameraRig = FindObjectOfType <OVRCameraRig>();
#else
        m_PvrController = FindObjectOfType <Pvr_Controller>();
        Pvr_ControllerManager.ChangeMainControllerCallBackEvent += OnChangeMainControllerCallback;
#endif
        m_InputModule = FindObjectOfType <SyncVRInputModule>();
    }
Example #3
0
    private void LoadController()
    {
        if (pvr_controller == null)
        {
            pvr_controller = GetComponent <Pvr_Controller>();
        }
        if (!isControllerConnected())
        {
            if (m_curController != null)
            {
                ControlCVRayShow(m_curController.gameObject, false);
            }
            m_headController.SetActive(true);
        }
        else
        {
            InputController.GetInstance().Hand = Pvr_UnitySDKAPI.Controller.UPvr_GetMainHandNess();
            m_headController.SetActive(false);
            if (isControllerConnected(0) && !isControllerConnected(1))  /**两种情况:1,双手柄,连了1,没连2;2,单手柄**/
            {
                if (pvr_controller == null)
                {
                    Debug.Log("pvr_controller is null");
                }
                if (m_curController != null)
                {
                    ControlCVRayShow(m_curController.gameObject, false);
                }
                m_curController = pvr_controller.controller0.transform;
                ControlCVRayShow(m_curController.gameObject, true);
            }
            else if (!isControllerConnected(0) && isControllerConnected(1)) /**一定是双手柄,练了1,没有连2**/
            {
                if (m_curController != null)
                {
                    ControlCVRayShow(m_curController.gameObject, false);
                }
                m_curController = pvr_controller.controller1.transform;
                ControlCVRayShow(m_curController.gameObject, true);
            }
            else if (isControllerConnected(0) && isControllerConnected(1)) /**一定是连了双手柄**/
            {
                ControlCVRayShow(pvr_controller.controller0, false);
                ControlCVRayShow(pvr_controller.controller1, false);
                if (InputController.GetInstance().Hand == 0)
                {
//                    if (m_curController != null)
//                        ControlCVRayShow(m_curController.gameObject, false);
                    m_curController = pvr_controller.controller0.transform;
                    ControlCVRayShow(m_curController.gameObject, true);
                }
                else
                {
//                    if (m_curController != null)
//                        ControlCVRayShow(m_curController.gameObject, false);
                    m_curController = pvr_controller.controller1.transform;
                    ControlCVRayShow(m_curController.gameObject, true);
                }
            }
        }
    }