コード例 #1
0
        public void OnEnable()
        {
            if (serializedObject != null)
            {
                serializedObject.Update();
            }

            headInput = (HeadInput)target;

            headTargetProp = serializedObject.FindProperty("headTarget");
        }
コード例 #2
0
        public static HeadInput Add(Transform parentTransform)
        {
            HeadInput headInput = parentTransform.GetComponentInChildren <HeadInput>();

            if (headInput != null)
            {
                return(headInput);
            }

            headInput = parentTransform.gameObject.AddComponent <HeadInput>();
            return(headInput);
        }
コード例 #3
0
        private void AddTeleporter()
        {
            Teleporter teleporter = Teleporter.Add(headTarget.transform, InteractionPointer.PointerType.FocusPoint);

            if (headTarget.unityVRHead.cameraTransform != null)
            {
                teleporter.transform.position = headTarget.unityVRHead.cameraTransform.position;
                teleporter.transform.rotation = headTarget.unityVRHead.cameraTransform.rotation;
            }
            teleporter.focusPointObj.transform.localPosition = new Vector3(0, 0, 2);

            HeadInput.Add(headTarget.transform);

            ControllerInput controllerInput = headTarget.humanoid.GetComponent <ControllerInput>();

            if (controllerInput != null)
            {
                controllerInput.leftButtonOneInput.SetMethod(teleporter.Click, InputEvent.EventType.Start);
            }
        }
コード例 #4
0
        private void AddInteractionPointer()
        {
            InteractionPointer pointer  = HumanoidInteractionPointer.Add(headTarget.transform, InteractionPointer.PointerType.FocusPoint);
            Camera             fpCamera = UnityVRHead.GetCamera(headTarget);

            if (fpCamera != null)
            {
                pointer.transform.position = fpCamera.transform.position;
                pointer.transform.rotation = fpCamera.transform.rotation;
            }
            pointer.focusPointObj.transform.localPosition = new Vector3(0, 0, 2);

            HeadInput.Add(headTarget.transform);

            ControllerInput controllerInput = headTarget.humanoid.GetComponent <ControllerInput>();

            if (controllerInput != null)
            {
                controllerInput.leftButtonOneInput.SetMethod(pointer.Click, InputEvent.EventType.Start);
            }
        }