Hello togheter,
I’m new here and to Unity and i make a 2D Top Down Shooter game with a friend, now we had a problem, i think its very simple, but i can’t figure out whats the problem…
i had a player Sprite looks down side and i attached a script for the movement to it. (also an Animator, Rigidbody2D and a BoxCollider2D)
Pic of the Sprite: https://i.imgur.com/DpUFZsh.png
i attached this code for looking at my mouse
void Update ()
{
if (isPC)
{
var mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
var heading = mousePos - transform.position;
var dist = heading.magnitude;
var dir = heading / dist;
if (dist > 5.02f)
{
var angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
var newRotation = Quaternion.AngleAxis(angle, Vector3.forward);
if (Quaternion.Angle(newRotation, transform.rotation) > 3f)
transform.rotation = newRotation;
}
}
}
and the sprite looks to the wrong side if i start the game, its look like this sprite guy had his eyes in his shoulders .
Ingame Pic: https://i.imgur.com/C9v4LkT.png
i hope you can help me
thank you and best regards
Oliver