Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class effectrotate : MonoBehaviour {
- // Update is called once per frame
- void Update () {
- Vector3 difference = Input.mousePosition - Camera.main.WorldToScreenPoint(transform.position);
- difference.Normalize();
- float rotZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;
- this.transform.rotation = Quaternion.Euler(0f, 0f, rotZ);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement