Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
rotations [2020/04/10 18:03] paul |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Rotations ====== | ||
- | |||
- | Unity uses 3 rotation systems. | ||
- | |||
- | - Euler Angers - rotation about x, y, z axis | ||
- | - Axis Angle - A normalized Vector3 | ||
- | - Quaternions | ||
- | |||
- | |||
- | |||
- | <code c#> | ||
- | // Convert from Quaternion to Euler: | ||
- | Vector3 inEuler = quaternionRotation.eulerAngles; | ||
- | |||
- | // Convert Euler to Quaternion | ||
- | Quaternion inQuaternion = Quaternion.Euler(inEuler); | ||
- | |||
- | // To Axis-Angle | ||
- | float angle; | ||
- | Vector3 axis; | ||
- | |||
- | randomRotatin | ||
- | </ | ||