// Update is called once per frame void Update() { for (int i = 0; i < Input.touches.Length; i++) { if (Input.touches[i].phase == TouchPhase.Began) { OnTouchBegin?.Invoke(Input.touches[i]); CastAtTouch(Input.touches[i]); } } }
private void BeginTouch(PointerEventData eventData) { m_pointerID = eventData.pointerId; m_lastPoint = eventData.position; m_touchDirection.Set(0, 0); m_delta.Set(0, 0); CalculateTouchDirection(eventData.position, eventData.pressEventCamera); onTouchBegin?.Invoke(m_touchDirection); }
public virtual void TouchBegin(Vector2 _touchScreenLocation) { touchWorldPoint = cameraRef.ScreenToWorldPoint(_touchScreenLocation); touchScreenCoordinate = _touchScreenLocation; startTouchLocation = endTouchLocation = _touchScreenLocation; _axisValue.x = 0; _axisValue.y = 0; touchInfo.touchWorldPoint = touchWorldPoint; touchInfo.touchScreenCoordinate = touchScreenCoordinate; touchInfo.endTouchLocation = endTouchLocation; touchInfo.deltaRelease = deltaRelease; touchInfo.touchScreenRatio = touchScreenRatio; OnTouchBegin?.Invoke(touchInfo); }
private void BeginTouch(PointerEventData eventData) { m_pointerID = eventData.pointerId; m_startTouchTime = Time.time; m_dist = 0; m_moved = false; m_resetMoveState = false; m_lastPoint = eventData.position; m_startPoint = m_lastPoint; CalculateTouchDirection(m_lastPoint); onTouchBegin?.Invoke(m_startPoint); }
void OnTapDown(int fingerId, Vector3 tapPosition) { myRay = mainCamera.ScreenPointToRay(tapPosition); if (Physics.Raycast(myRay, out hitInfo, raycastLength, uiLayer, QueryTriggerInteraction.Collide)) { uiScreenPressed = true; OnUITouchBegin?.Invoke(fingerId, tapPosition, hitInfo); } else { myRay = mainCamera.ScreenPointToRay(tapPosition); if (Physics.Raycast(myRay, out hitInfo, raycastLength, Camera.main.cullingMask, QueryTriggerInteraction.Collide)) { OnTouchBegin?.Invoke(fingerId, tapPosition, hitInfo); } else { OnTouchBegin?.Invoke(fingerId, tapPosition, new RaycastHit()); } } }
public override void TouchesBegan(NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); OnTouchBegin?.Invoke(); }