HereThis is the updatedmy code , im using a raycast to detect if the dial is clicked/dragged.
public static float DegreesCCWFromRight(Vector2 center, Vector2 pointer) { var direction = pointer - center; return Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; } private void RotateObject() { Vector2 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast(worldPoint, Vector3.forward); if (Input.GetMouseButtonDown(0)) { if (hit.collider && hit.collider.GetComponent<Rotate2d>()) { { deltaRotation = 0f; previousRotation = DegreesCCWFromRightangleBetweenPoints(transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition)); } } else if (Input.GetMouseButton(0)) { if (hit.collider && hit.collider.GetComponent<Rotate2d>()) { currentRotation = DegreesCCWFromRightangleBetweenPoints(transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition)); deltaRotation = Mathf.DeltaAngle(currentRotation, previousRotation = currentRotation;); if (Mathf.Abs(deltaRotation) > deltaLimit) Vector2 mouseWorld = Camera.main.ScreenToWorldPoint(Input.mousePosition); { float angle deltaRotation = DegreesCCWFromRight(transform.position,deltaLimit mouseWorld* Mathf.Sign(deltaRotation); } const float incrementCount = 8; previousRotation = currentRotation; angle = Mathfhit.Roundcollider.gameObject.transform.Rotate(currentRotationVector3.back * incrementCount /Time.deltaTime, 360deltaRotation); } } I forgot to add, here is my angle between points method.
float angleBetweenPoints(Vector2 position1, Vector2 position2) { Vector2 fromLine = position2 - position1; *Vector2 360toLine /= incrementCount;new Vector2(1, 0); float angle = Vector2.Angle(fromLine, toLine); Vector3 cross = hit.collider.gameObject.transformVector3.localEulerAnglesCross(fromLine, =toLine); new Vector3 // did we wrap around? if (0,cross.z 0,> angle0); { }angle = 360f - angle; } return angle; } Edit: updated the code. Added actual dial image.

