유니티에서 3D 객체 회전시키기
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System; | |
public class RotateObjectBehaviour : MonoBehaviour { | |
private float sensitivity = 3f; | |
private void OnMouseDrag() { | |
float rotX = Input.GetAxis ("Mouse X") * sensitivity * Mathf.Deg2Rad; | |
float rotY = Input.GetAxis ("Mouse Y") * sensitivity * Mathf.Deg2Rad; | |
transform.RotateAround (transform.up, -rotX); | |
transform.RotateAround (Vector3.right, rotY); | |
} | |
} |
댓글
댓글 쓰기