Exemple #1
0
        void SetupVive2Controllers()
        {
            if (null == steamVRPlayArea)
            {
                steamVRPlayArea = FindObjectOfType <SteamVR_PlayArea>();
            }

            if (null != steamVRPlayArea)
            {
                foreach (SteamVR_Behaviour_Pose pose in steamVRPlayArea.GetComponentsInChildren <SteamVR_Behaviour_Pose>(true))
                {
                    if (pose.inputSource == SteamVR_Input_Sources.RightHand)
                    {
                        controllerRight = pose.transform;
                    }
                    else if (pose.inputSource == SteamVR_Input_Sources.LeftHand)
                    {
                        controllerLeft = pose.transform;
                    }
                }

                centerEye = steamVRPlayArea.GetComponentInChildren <Camera>(true).transform;
            }
            else
            {
                Debug.LogError("Please import SteamVR Plugin and put [CameraRig] prefab into your scene");
            }
        }
Exemple #2
0
    void SetupSteamVR2Controllers()
    {
        if (steamVRPlayArea == null)
        {
            steamVRPlayArea = FindObjectOfType <SteamVR_PlayArea>();
        }

        if (steamVRPlayArea != null)
        {
            foreach (SteamVR_Behaviour_Pose poseComp in steamVRPlayArea.GetComponentsInChildren <SteamVR_Behaviour_Pose>(true))
            {
                if (poseComp.inputSource == SteamVR_Input_Sources.RightHand)
                {
                    m_rightController = poseComp.gameObject;
                }
                else if (poseComp.inputSource == SteamVR_Input_Sources.LeftHand)
                {
                    m_leftController = poseComp.gameObject;
                }
            }
        }
        else
        {
            Valve.VR.InteractionSystem.Player PlayerComponent = FindObjectOfType <Valve.VR.InteractionSystem.Player>();

            m_rightController = PlayerComponent.rightHand.gameObject;
            m_leftController  = PlayerComponent.leftHand.gameObject;
        }

        if (m_steamVRClickAction == null)
        {
            Debug.LogError("CURVEDUI: No SteamVR action to use for button interactions. Choose the action you want to use to click the buttons on CurvedUISettings component.");
        }
    }
    void SetupSteamVR2Controllers()
    {
        if (steamVRPlayArea == null)
        {
            steamVRPlayArea = FindObjectOfType <SteamVR_PlayArea>();
        }

        if (steamVRPlayArea != null)
        {
            foreach (SteamVR_Behaviour_Pose poseComp in steamVRPlayArea.GetComponentsInChildren <SteamVR_Behaviour_Pose>(true))
            {
                if (poseComp.inputSource == SteamVR_Input_Sources.RightHand)
                {
                    m_rightController = poseComp.gameObject;
                }
                else if (poseComp.inputSource == SteamVR_Input_Sources.LeftHand)
                {
                    m_leftController = poseComp.gameObject;
                }
            }
        }
        else
        {
            Debug.LogError("CURVEDUI: Can't find SteamVR_PlayArea component on the scene. Add a reference to it manually to CurvedUIInputModule on EventSystem gameobject.", this.gameObject);
        }

        if (m_steamVRClickAction == null)
        {
            Debug.LogError("CURVEDUI: No SteamVR action to use for button interactions. Choose the action you want to use to click the buttons on CurvedUISettings component.");
        }
    }
Exemple #4
0
    void Start()
    {
        selectionMgr = GetComponent <UnitSelectionManager>();
        var laserPointers = steamVRCameraRig.GetComponentsInChildren <SteamVR_LaserPointer>();

        if (laserPointers != null)
        {
            foreach (var laserPointer in laserPointers)
            {
                laserPointer.PointerIn    += OnHighlightObject;
                laserPointer.PointerOut   += OnUnhighlightObject;
                laserPointer.PointerClick += OnSelectObject;
            }
        }
    }
Exemple #5
0
    void SetupSteamVR2Controllers()
    {
        if (steamVRPlayArea == null)
        {
            steamVRPlayArea = FindObjectOfType <SteamVR_PlayArea>();
        }

        if (steamVRPlayArea != null)
        {
            foreach (SteamVR_Behaviour_Pose poseComp in steamVRPlayArea.GetComponentsInChildren <SteamVR_Behaviour_Pose>(true))
            {
                if (poseComp.inputSource == SteamVR_Input_Sources.RightHand)
                {
                    m_rightController = poseComp.gameObject;
                }
                else if (poseComp.inputSource == SteamVR_Input_Sources.LeftHand)
                {
                    m_leftController = poseComp.gameObject;
                }
            }
        }
        else
        {
#if CURVEDUI_STEAMVR_INT
            //Optional - SteamVR Interaction System
            Valve.VR.InteractionSystem.Player PlayerComponent = FindObjectOfType <Valve.VR.InteractionSystem.Player>();

            if (PlayerComponent != null)
            {
                m_rightController = PlayerComponent.rightHand.gameObject;
                m_leftController  = PlayerComponent.leftHand.gameObject;
            }
            else
#endif
            Debug.LogError("CURVEDUI: Can't find SteamVR_PlayArea component or InteractionSystem.Player component on the scene. One of these is required. Add a reference to it manually to CurvedUIInputModule on EventSystem gameobject.", this.gameObject);
        }

        if (m_steamVRClickAction == null)
        {
            Debug.LogError("CURVEDUI: No SteamVR action to use for button interactions. Choose the action you want to use to click the buttons on CurvedUISettings component.");
        }
    }