private void FinishControllerSetup(GameObject controllerModelGameObject, InteractionSourceHandedness handedness, string dictionaryKey)
        {
            var parentGameObject = new GameObject
            {
                name = handedness + "Controller"
            };

            parentGameObject.transform.parent          = transform;
            controllerModelGameObject.transform.parent = parentGameObject.transform;

            var newControllerInfo = new MotionControllerInfo(parentGameObject, handedness);

            newControllerInfo.LoadInfo(controllerModelGameObject.GetComponentsInChildren <Transform>());

            if (handedness == InteractionSourceHandedness.Left)
            {
                leftControllerModel = newControllerInfo;
            }
            else if (handedness == InteractionSourceHandedness.Right)
            {
                rightControllerModel = newControllerInfo;
            }

            if (OnControllerModelLoaded != null)
            {
                OnControllerModelLoaded(newControllerInfo);
            }

            loadingControllers.Remove(dictionaryKey);
            controllerDictionary.Add(dictionaryKey, newControllerInfo);
        }
コード例 #2
0
        private void FinishControllerSetup(GameObject controllerModelGameObject, InteractionSourceHandedness handedness, string dictionaryKey)
        {
            Debug.Log("Make Comtroller");

            var parentGameObject = new GameObject
            {
                name = handedness + "Controller"
            };

            parentGameObject.transform.parent          = transform;
            controllerModelGameObject.transform.parent = parentGameObject.transform;

            var newControllerInfo = new MotionControllerInfo(parentGameObject, handedness);

            newControllerInfo.LoadInfo(controllerModelGameObject.GetComponentsInChildren <Transform>());

            if (handedness == InteractionSourceHandedness.Left)
            {
                leftControllerModel = newControllerInfo;
            }
            else if (handedness == InteractionSourceHandedness.Right)
            {
                rightControllerModel = newControllerInfo;
            }

            if (OnControllerModelLoaded != null)
            {
                OnControllerModelLoaded(newControllerInfo);
            }

            loadingControllers.Remove(dictionaryKey);
            controllerDictionary.Add(dictionaryKey, newControllerInfo);

            //컨트롤러가 생성되면 찾아서 태그를 바꾸어 준다//
            conL = GameObject.Find("LeftController");
            conR = GameObject.Find("RightController");
            if (conL != null)
            {
                //컨트롤러 레이져 봉 추가//
                lineL.SetActive(true);
                lineL.transform.parent        = conL.transform;
                lineL.transform.localPosition = Vector3.zero;
                //레이어 위치 변경//
                //conL.layer = 9;
                ChangeLayer(conL.transform, 9);
                Debug.Log("왼쪽 컨트롤러 생성!::: " + conL.layer);
            }
            if (conR != null)
            {
                //컨트롤러 레이져 봉 추가//
                lineR.SetActive(true);
                lineR.transform.parent        = conR.transform;
                lineR.transform.localPosition = Vector3.zero;

                //레이어 위치 변경//
                //conR.layer = 9;
                ChangeLayer(conR.transform, 9);
                Debug.Log("오른쪽 컨트롤러 생성!::: " + conR.layer);
            }
        }
コード例 #3
0
        private void FinishControllerSetup(GameObject controllerModelGameObject, string handedness, uint id)
        {
            var parentGameObject = new GameObject
            {
                name = handedness + "Controller"
            };

            parentGameObject.transform.parent          = transform;
            controllerModelGameObject.transform.parent = parentGameObject.transform;

            var newControllerInfo = new MotionControllerInfo()
            {
                ControllerParent = parentGameObject
            };

            if (AnimateControllerModel)
            {
                newControllerInfo.LoadInfo(controllerModelGameObject.GetComponentsInChildren <Transform>(), this);
            }
            controllerDictionary.Add(id, newControllerInfo);
        }