Quaternion.Euler, AngleAxis

public static Quaternion Euler(float x, float y, float z); 오일러각을 쿼터니언 회전각으로 반환 

public static Quaternion Euler(Vector3 euler);   Vector3 인자값 사용 (위의 수치를 한꺼번에 사용한 것과 다름없다) 

public static Quaternion AngleAxis(float angle, Vector3 axis); axis 축 방향을 중심으로 angle 각 만큼 회전


Quaternion.Angle, Inverse, Dot

public static float Angle(Quaternion a, Quaternion b); 두 쿼터니언 회전각 a, b 사이의 차이각 

public static Quaternion Inverse(Quaternion rotation); rotation의 inverse를 반환 

public static float Dot(Quaternion a, Quaternion b); 두개의 rotation 사이의 내적

( 0.7, 0.0, 0.0, 0.7) 

(-0.7, 0.0, 0.0, 0.7) 

180 

(-0.7, 0.0, 0.0, 0.7)


Quaternion.FromToRotation, LookRotation, RotateTowards

public static Quaternion FromToRotation(Vector3 fromDirection, Vector3 toDirection); from 백터방향에서 to백터방향으로 회전한 각도를 쿼터니언으로 반환 

public static Quaternion LookRotation(Vector3 forward); 지정된 방향 백터로 쿼터니언 회전 각 반환 

public static Quaternion RotateTowards(Quaternion from, Quaternion to, float maxDegreesDelta); 

from에서 to까지의 quaternion 회전각 차이에서 maxDegreesDelta 수치 만큼 회전


Quaternion.Lerp, Slerp

public static Quaternion Lerp(Quaternion a, Quaternion b, float t); 변화 전 a와 변화 후 b 사이를 정규화한 변화량 t(0.0f~1.0f) 로 선형보간한다. 

public static Quaternion Slerp(Quaternion a, Quaternion b, float t); 변화 전 a와 변화 후 b 사이를 정규화한 변화량 t(0.0f~1.0f) 로 구면보간한다. 

public static Quaternion Lerp/SlerpUnclamped(Quaternion a, Quaternion b, float t); 사이 입력값의 한계치를 제한하지 않는다. 

mathf.LerpUnclamped(1.0, 2.0, 1.5) == 2.5 vs mathf.Lerp(1.0, 2.0, 1.5) == 2.0                    

slerp/lerp 비교 링크 -  https://imgur.com/r/Unity3D/FeKRE1c



씬안에 있는 모든 게임 오브젝트는 기본적으로 Transform 컴포넌트를 갖고 있다. ( Normal - > Debug 전환 모습 )

 

Transform을 통하여 객체에 대한 좌표(Position), 회전(Rotation), 크기(Scale) 들을 저장하고 조작할 수 있다.

열거자 (enumerators)를 지원하므로 부모 자식 계층구조에서 루프 탐색을 허용한다. 

Transform.position, localPosition

public Vector3 position { get; set; }

해당 트랜스폼의 월드 좌표를 나타낸다.

public Vector3 localPosition { get; set; }

부모에 대한 상대좌표이다. (부모의 zero좌표가 기준점이 된다, 부모가 없다면 월드좌표 공간이 기준이 된다.)

속성을 나타내므로 하위 컴포넌트 값을 설정할 수는 없다. 

Transform.lossyscale, localScale

public Vector3 lossyScale { get; } 해당 트랜스폼의 월드 크기를 나타낸다. (읽기 전용)

public Vector3 localScale { get; set; } 부모에 대한 하위 트랜스폼의 상대크기 이다.  (부모가 없다면 월드크기와 같다.)

Transform.rotation, localRotation

public Quaternion rotation { get; set; } 쿼터니언(quaternion) 으로 트랜스폼의 회전각을 나타낸다.

public Quaternion localRotation { get; set; } 부모(쿼터니언 회전각)에 대한 해당 트랜스폼의 쿼터니언 회전각을 나타낸다.


Transform.eulerAngles, localEulerAngles

public Vector3 eulerAngles { get; set; } 오일러앵글로 트랜스폼의 회전각을 나타낸다. 

public Vector3 localEulerAngles { get; set; } 부모의 트랜스폼 회전각에 대하여 해당 회전각의 오일러앵글을 나타낸다.

오일러회전에서는 짐벌락 현상이 발생하므로  Quternian(쿼터니언) 회전을 사용하거나 제한된 범위에서 회전으로 설계해야 한다.

짐벌락 발생 : 두번째 회전이 90도 또는 270도에 가까워 질 때 첫 번째 회전축과 세 번째 회전의 두개 축이 거의 일치하여 자유도가 2축으로 한정되는 현상 


+ Recent posts