private static void UpdateMathStuff() { var mousePos = hand == ActionMenuHand.Left ? Utilities.GetCursorPosLeft() : Utilities.GetCursorPosRight(); radialPuppetMenuRight.GetCursor().transform.localPosition = mousePos * 4; if (Vector2.Distance(mousePos, Vector2.zero) > 12) { var angleOriginal = Mathf.Round(Mathf.Atan2(mousePos.y, mousePos.x) * Constants.RAD_TO_DEG); var eulerAngle = Utilities.ConvertFromDegToEuler(angleOriginal); var normalisedAngle = eulerAngle / 360f; if (Math.Abs(normalisedAngle - currentValue) < 0.0001f) { return; } if (!restricted) { current.SetAngle(eulerAngle); current.UpdateArrow(angleOriginal, eulerAngle); } else { if (currentValue > normalisedAngle) { if (currentValue - normalisedAngle < 0.5f) { current.SetAngle(eulerAngle); current.UpdateArrow(angleOriginal, eulerAngle); currentValue = normalisedAngle; } else { current.SetAngle(360); current.UpdateArrow(90, 360); currentValue = 1f; } } else { if (normalisedAngle - currentValue < 0.5f) { current.SetAngle(eulerAngle); current.UpdateArrow(angleOriginal, eulerAngle); currentValue = normalisedAngle; } else { current.SetAngle(0); current.UpdateArrow(90, 0); currentValue = 0; } } } } }
private static void UpdateMathStuff() { Vector2 mousePos = (hand == ActionMenuHand.Left) ? Utilities.GetCursorPosLeft() : Utilities.GetCursorPosRight(); radialPuppetMenuRight.GetCursor().transform.localPosition = mousePos * 4; if (Vector2.Distance(mousePos, Vector2.zero) > 12) { double angleOriginal = Math.Round(((float)Math.Atan2(mousePos.y, mousePos.x)) * Constants.radToDeg); double eulerAngle = Utilities.ConvertFromDegToEuler(angleOriginal); current.SetAngle((float)eulerAngle); current.UpdateArrow(angleOriginal, eulerAngle); } }