4차원 행렬로 표현
https://docs.unity3d.com/2020.3/Documentation/ScriptReference/Quaternion.html
Unity - Scripting API: Quaternion
They are compact, don't suffer from gimbal lock and can easily be interpolated. Unity internally uses Quaternions to represent all rotations. They are based on complex numbers and are not easy to understand intuitively. You almost never access or modify in
docs.unity3d.com
우리가 알고있는 x,y,z 삼원체계와 다른것
public class QuaternionClass : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Debug.Log("Quaternion x = " + transform.rotation.x);
Debug.Log("Degree x = " + transform.eulerAngles.x);
}
// Update is called once per frame
void Update()
{
transform.rotation =
Quaternion.Lerp(transform.rotation,Quaternion.Euler(180,0,0),0.1f);
//현재 회전값에서 쿼터니언 회전값까지 회전시키는것
콘솔창에서 보면 쿼터니언 체계와 디그리 체계가 다른것을 알 수 있다.
디그리에서30도가 우리가 알고있는 30도 회전값이다.
'Metaverse World Creator > Unity & C#' 카테고리의 다른 글
10_[VR개발] 프로젝트 생성 및 세팅 / GoogleVR SDK (0) | 2022.05.17 |
---|---|
09_ObjectClass_생성과 파괴 (0) | 2022.05.14 |
07_Transform 클래스 알아보기 (0) | 2022.05.12 |
06_유니티에서 스크립트와 API (0) | 2022.05.11 |
05_유니티에서 스크립트 생성하기 / C# void strat / void update의 차이 (0) | 2022.05.09 |