I have this code:
void Update () {
Vector3 mousePos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0);
Vector3 lookPos = Camera.main.ScreenToWorldPoint(mousePos);
lookPos = lookPos - transform.position;
float angle = Mathf.Atan2(lookPos.y, lookPos.x) * Mathf.Rad2Deg;
if (angle < 270 && angle > 90)
transform.localScale = new Vector3(0.6f, -0.6f, 0f);
else
transform.localScale = new Vector3(0.6f, 0.6f, 0f);
transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
}
It should flip the sprite in the “y” axis if the angle is in between 90 and 270, but it just seems to be checking if the angle is in between 90 and 180, what could be happening?
