Answer the question
In order to leave comments, you need to log in
Why does the player look not at the mouse, but a little to the side?
Tipo over time, for some reason, does not look at the mouse, but a little to the side.
private void LookToMouse()
{
Vector3 mouseposition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector2 direction = transform.position + mouseposition;
float Angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(Angle, Vector3.forward);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question