init
This commit is contained in:
commit
a8c6025cd3
158 changed files with 86052 additions and 0 deletions
17
Assets/Scripts/Aim.cs
Normal file
17
Assets/Scripts/Aim.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Aim : MonoBehaviour{
|
||||
|
||||
public Vector3 difference;
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
|
||||
difference.Normalize();
|
||||
|
||||
float rotZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;
|
||||
transform.rotation = Quaternion.Euler(0f, 0f, rotZ);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue