void IControllerInputHandler.OnInputPositionChanged(InputPositionEventData eventData) { // Debug.Log(eventData.PressType.ToString()); var target = eventData.selectedObject; if (target != lastTarget) { lastTarget = target; if (lastTarget != null) { so = lastTarget.GetComponent <Slam.SlamObject>(); } } if (eventData.PressType == InteractionSourcePressInfo.Thumbstick) { if (EnableTeleport) { if (currentPointingSource == null && eventData.Position.y > 0.8 && Math.Abs(eventData.Position.x) < 0.3) { if (so != null && (so.WalkFloor || so.SitPlane)) { if (FocusManager.Instance.TryGetPointingSource(eventData, out currentPointingSource)) { currentSourceId = eventData.SourceId; StartTeleport(); } } } else if (currentPointingSource != null && currentSourceId == eventData.SourceId && eventData.Position.magnitude < 0.2) { FinishTeleport(); } } if (EnableStrafe && currentPointingSource == null) { if (eventData.Position.y < -0.8 && Math.Abs(eventData.Position.x) < 0.3) { DoStrafe(Vector3.back * StrafeAmount); } } if (EnableRotation && currentPointingSource == null) { if (eventData.Position.x < -0.8 && Math.Abs(eventData.Position.y) < 0.3) { DoRotation(-RotationSize); } else if (eventData.Position.x > 0.8 && Math.Abs(eventData.Position.y) < 0.3) { DoRotation(RotationSize); } } } }
private void InitializeEventDatas() { inputEventData = new InputEventData(EventSystem.current); sourceClickedEventData = new InputClickedEventData(EventSystem.current); sourceStateEventData = new SourceStateEventData(EventSystem.current); sourceRotationEventData = new SourceRotationEventData(EventSystem.current); sourcePositionEventData = new SourcePositionEventData(EventSystem.current); manipulationEventData = new ManipulationEventData(EventSystem.current); navigationEventData = new NavigationEventData(EventSystem.current); holdEventData = new HoldEventData(EventSystem.current); pointerSpecificEventData = new PointerSpecificEventData(EventSystem.current); inputPositionEventData = new InputPositionEventData(EventSystem.current); selectPressedEventData = new SelectPressedEventData(EventSystem.current); }
void IControllerInputHandler.OnInputPositionChanged(InputPositionEventData eventData) { if (eventData.PressType == InteractionSourcePressInfo.Thumbstick) //float leftTrigger = Input.GetAxis(InputMappingAxisUtility.CONTROLLER_LEFT_TRIGGER); //if (leftTrigger > 0.8) { if (EnableTeleport) { if (currentPointingSource == null && eventData.Position.y > 0.8 && Math.Abs(eventData.Position.x) < 0.3) //if (currentPointingSource == null && leftTrigger > 0.8) { if (FocusManager.Instance.TryGetPointingSource(eventData, out currentPointingSource)) { currentSourceId = eventData.SourceId; // StartTeleport(); } } else if (currentPointingSource != null && currentSourceId == eventData.SourceId && eventData.Position.magnitude < 0.2) //else if (currentPointingSource != null && leftTrigger < 0.2) { // FinishTeleport(); } } if (EnableStrafe && currentPointingSource == null) { if (eventData.Position.y < -0.8 && Math.Abs(eventData.Position.x) < 0.3) { DoStrafe(Vector3.back * StrafeAmount); } } if (EnableRotation && currentPointingSource == null) { if (eventData.Position.x < -0.8 && Math.Abs(eventData.Position.y) < 0.3) { DoRotation(-RotationSize); } else if (eventData.Position.x > 0.8 && Math.Abs(eventData.Position.y) < 0.3) { DoRotation(RotationSize); } } } }
private void InitializeEventDatas() { inputEventData = new InputEventData(EventSystem.current); sourceClickedEventData = new InputClickedEventData(EventSystem.current); sourceStateEventData = new SourceStateEventData(EventSystem.current); manipulationEventData = new ManipulationEventData(EventSystem.current); navigationEventData = new NavigationEventData(EventSystem.current); holdEventData = new HoldEventData(EventSystem.current); pointerSpecificEventData = new PointerSpecificEventData(EventSystem.current); inputPositionEventData = new InputPositionEventData(EventSystem.current); selectPressedEventData = new SelectPressedEventData(EventSystem.current); sourceRotationEventData = new SourceRotationEventData(EventSystem.current); sourcePositionEventData = new SourcePositionEventData(EventSystem.current); xboxControllerEventData = new XboxControllerEventData(EventSystem.current); #if UNITY_WSA || UNITY_STANDALONE_WIN speechEventData = new SpeechEventData(EventSystem.current); dictationEventData = new DictationEventData(EventSystem.current); #endif }
void IControllerInputHandler.OnInputPositionChanged(InputPositionEventData eventData) { if (eventData.PressType == InteractionSourcePressType.Thumbstick) { if (EnableTeleport) { if (currentPointingSource == null && eventData.Position.y > 0.8 && Math.Abs(eventData.Position.x) < 0.3) { if (FocusManager.Instance.TryGetPointingSource(eventData, out currentPointingSource)) { currentSourceId = eventData.SourceId; StartTeleport(); } } else if (currentPointingSource != null && currentSourceId == eventData.SourceId && eventData.Position.magnitude < 0.2) { FinishTeleport(); } } if (EnableStrafe && currentPointingSource == null) { if (eventData.Position.y < -0.8 && Math.Abs(eventData.Position.x) < 0.3) { DoStrafe(Vector3.back * StrafeAmount); } } if (EnableRotation && currentPointingSource == null) { if (eventData.Position.x < -0.8 && Math.Abs(eventData.Position.y) < 0.3) { DoRotation(-RotationSize); } else if (eventData.Position.x > 0.8 && Math.Abs(eventData.Position.y) < 0.3) { DoRotation(RotationSize); } } } }