Example #1
0
        private void AddTeleporter()
        {
            Teleporter teleporter = Teleporter.Add(handTarget.transform);

            if (handTarget.isLeft)
            {
                teleporter.transform.localPosition = new Vector3(-0.21F, -0.02F, 0.01F);
                teleporter.transform.localRotation = Quaternion.Euler(-180, 90, 180);
            }
            else
            {
                teleporter.transform.localPosition = new Vector3(0.21F, -0.02F, 0.01F);
                teleporter.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(teleporter.Activation, InputEvent.EventType.Change);
                    controllerInput.leftTrigger1Input.SetMethod(teleporter.Click, InputEvent.EventType.Change);
                }
                else
                {
                    controllerInput.rightButtonOneInput.SetMethod(teleporter.Activation, InputEvent.EventType.Change);
                    controllerInput.rightTrigger1Input.SetMethod(teleporter.Click, InputEvent.EventType.Change);
                }
            }
        }
Example #2
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);
            }
        }