can anyone help me solve this problem
using UnityEngine;
using System.Collections;
public class Aim : MonoBehaviour {
public GameObject player;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
Vector3 dir = Input.mousePosition - Camera.main.WorldToScreenPoint (transform.position);
if (dir.x <= 90) {
player.transform.localRotation = Quaternion.Euler (180,0,180);
} else {
player.transform.localRotation = Quaternion.Euler (0, 0, 0);
}
float angle = Mathf.Atan2 (dir.y, dir.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis (angle, Vector3.forward);
}
}