void ViewJoystickUpdate(ref TouchEvent evt) { Vector2 delta; if (GuiHUD.Instance != null) { GuiHUD.Instance.AimJoystickDown(evt.Position); } if (m_ViewJoystick.FirstDelta) { m_ViewJoystick.AddDelta(evt.Position - m_ViewJoystick.LastTouchPosition); delta = m_ViewJoystick.GetDelta(); //Debug.Log(Time.timeSinceLevelLoad + " FirstDelta : " + evt.Position.y + " delta " + (evt.Position - ViewJoystick.LastTouchPosition).y + " / " + delta.x + "-" + delta.y ); } else { m_ViewJoystick.AddDelta(evt.Position - m_ViewJoystick.LastTouchPosition); delta = m_ViewJoystick.GetDelta(); //Debug.Log(Time.timeSinceLevelLoad + " NextDelta : " + evt.Position.y + " delta " + (evt.Position - ViewJoystick.LastTouchPosition).y + " / " + + delta.x + "-" + delta.y); // delta = evt.Position - ViewJoystick.LastTouchPosition; //Debug.Log(Time.timeSinceLevelLoad + " testing Delta : " + evt.Position.y + " delta " + delta.y); } m_ViewJoystick.LastTouchPosition = evt.Position; // Debug.Log(Time.timeSinceLevelLoad + " unity delta " + touch.deltaPosition + " my delta" + delta); if (delta != Vector2.zero) { m_ViewJoystick.FirstDelta = false; float DegreePerPixelsY = 45.0f / (Screen.width * 0.25f); float DegreePerPixelsP = 30.0f / (Screen.height * 0.25f); // Debug.Log(Time.timeSinceLevelLoad + " degreePerPixelY " + DegreePerPixelsY + " DegreePerPixelP " + DegreePerPixelsP); //delta.x *= Mathf.Abs(delta.x); //delta.y *= Mathf.Abs(delta.y); float yaw = delta.x * DegreePerPixelsY; float pitch = delta.y * DegreePerPixelsP; //apply options sensitivity float touchSensitivity = GetSensitivity(); yaw *= touchSensitivity; pitch *= touchSensitivity * 0.7f; //Debug.Log(Time.timeSinceLevelLoad + " yaw " + yaw + " pitch " + pitch + " timedelta " + Time.deltaTime); m_ViewJoystick.Yaw = yaw; m_ViewJoystick.Pitch = -pitch; m_ViewJoystick.Updated = true; } }