Home Game Development unity – Circle coloration rotate minigame match drawback

unity – Circle coloration rotate minigame match drawback

0
unity – Circle coloration rotate minigame match drawback

[ad_1]

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 considering of checking with colliders that the 2 factors originally of 1 coloration and the top match with some tolerance to the opposite circle which additionally has such collider factors set, however I do not know if this can be a good answer.
Graphics in connect is simply placeholder and that motive is little unscale.

Current rotate script:

public class RotateCircleMinigame: MonoBehaviour
{
 
    non-public Vector3 screenPos;
    non-public float angleOffset;
 
    void Update()
    {
        Vector3 mousePos = Camera.most important.ScreenToWorldPoint(Input.mousePosition);
        if (Input.GetMouseButtonDown(0))
        {
            screenPos = Camera.most important.WorldToScreenPoint(remodel.place);
            Vector3 vector3 = Input.mousePosition - screenPos;
            angleOffset = (Mathf.Atan2(remodel.proper.y, remodel.proper.x) - Mathf.Atan2(vector3.y, vector3.x)) * Mathf.Rad2Deg;
        }
 
        if (Input.GetMouseButton(0))
        {
            Vector3 vector3 = Input.mousePosition - screenPos;
            float angle = Mathf.Atan2(vector3.y, vector3.x) * Mathf.Rad2Deg;
            remodel.eulerAngles = new Vector3(0, 0, angle + angleOffset);
        }
    }
}

Image 1 - on start rotate
Image 2 - correct rotates to finish

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here