private void Update() { if (m_touchArea.PointerDown) { if (!started) { StartTouch(); } Vector2 touchPosition = m_viewport.ScreenToWorldPoint(m_touchArea.TouchPosition); if (m_touchVisual != null) { m_touchVisual.transform.position = touchPosition; Quaternion visualRotation = Quaternion.Euler(0, 0, transform.position.ZAngleTo(touchPosition)); m_touchVisual.transform.rotation = visualRotation; } float turnAngle = transform.position.ZAngleTo(touchPosition); if (Mathf.Abs(Mathf.DeltaAngle(m_ship.TurnGoal, turnAngle)) > m_tolerance) { m_ship.TurnTo(turnAngle); } } else { if (started) { EndTouch(); } } }
private void Update() { if (m_input.PointerDown) { if (!started) { StartTouch(); } Vector2 input = m_input.Axes; float turnAngle = input.ZAngle(); if (Mathf.Abs(Mathf.DeltaAngle(m_ship.TurnGoal, turnAngle)) > m_tolerance) { m_ship.TurnTo(turnAngle); } } else { if (started) { EndTouch(); } } }