I have a sprite with a script that turns it towards the mouse. However, the sprites front is not where I want it to be, so there’s a certain offset with the angle. Can I change where the sprites front is on the sprite itself?
public class LookAtMouse : MonoBehaviour
{
// Update is called once per frame
void Update()
{
Vector3 mouseScreenPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3 lookAt = mouseScreenPosition;
float AngleRad = Mathf.Atan2(lookAt.y - this.transform.position.y, lookAt.x - this.transform.position.x);
float AngleDeg = (180 / Mathf.PI) * AngleRad;
this.transform.rotation = Quaternion.Euler(0, 0, AngleDeg);
}
}