I’m making a minigame that includes rotating coloured circles in order that the colours match relative to the central circle which isn’t rotatable. I used to be pondering of checking with colliders that the 2 factors in the beginning of 1 colour and the tip match with some tolerance to the opposite circle which additionally has such collider factors set, however I do not know if it is a good answer.
Graphics in connect is simply placeholder and that purpose is little unscale.
Present rotate script:
public class RotateCircleMinigame: MonoBehaviour
{
non-public Vector3 screenPos;
non-public float angleOffset;
void Replace()
{
Vector3 mousePos = Digital camera.fundamental.ScreenToWorldPoint(Enter.mousePosition);
if (Enter.GetMouseButtonDown(0))
{
screenPos = Digital camera.fundamental.WorldToScreenPoint(remodel.place);
Vector3 vector3 = Enter.mousePosition - screenPos;
angleOffset = (Mathf.Atan2(remodel.proper.y, remodel.proper.x) - Mathf.Atan2(vector3.y, vector3.x)) * Mathf.Rad2Deg;
}
if (Enter.GetMouseButton(0))
{
Vector3 vector3 = Enter.mousePosition - screenPos;
float angle = Mathf.Atan2(vector3.y, vector3.x) * Mathf.Rad2Deg;
remodel.eulerAngles = new Vector3(0, 0, angle + angleOffset);
}
}
}