Ejemplo n.º 1
0
        private void AddInteractionPointer()
        {
            InteractionPointer pointer = HumanoidInteractionPointer.Add(handTarget.transform, InteractionPointer.PointerType.Ray);

            if (handTarget.isLeft)
            {
                pointer.transform.localPosition = new Vector3(-0.21F, -0.02F, 0.01F);
                pointer.transform.localRotation = Quaternion.Euler(-180, 90, 180);
            }
            else
            {
                pointer.transform.localPosition = new Vector3(0.21F, -0.02F, 0.01F);
                pointer.transform.localRotation = Quaternion.Euler(-180, -90, -180);
            }

            //HandInput.Add(handTarget.transform);

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

            if (controllerInput != null)
            {
                if (handTarget.isLeft)
                {
                    controllerInput.leftButtonOneInput.SetMethod(pointer.Activation, InputEvent.EventType.Change);
                    controllerInput.leftTrigger1Input.SetMethod(pointer.Click, InputEvent.EventType.Change);
                }
                else
                {
                    controllerInput.rightButtonOneInput.SetMethod(pointer.Activation, InputEvent.EventType.Change);
                    controllerInput.rightTrigger1Input.SetMethod(pointer.Click, InputEvent.EventType.Change);
                }
            }
        }
Ejemplo n.º 2
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);
            }
        }