public void OnEnable()
        {
            if (serializedObject != null)
            {
                serializedObject.Update();
            }

            headInput = (HeadInput)target;

            headTargetProp = serializedObject.FindProperty("headTarget");
        }
        public static HeadInput Add(Transform parentTransform)
        {
            HeadInput headInput = parentTransform.GetComponentInChildren <HeadInput>();

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

            headInput = parentTransform.gameObject.AddComponent <HeadInput>();
            return(headInput);
        }
Example #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);
            }
        }
Example #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);
            }
        }