diff options
author | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
commit | 22891bf59032ba88262824255a706d652031384b (patch) | |
tree | 7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/Scripts/Utils/QuaternionUtility.cs | |
parent | 8b04ea73e540067f83870b61d89db4868fea5e8a (diff) |
* move folder
Diffstat (limited to 'Assets/Scripts/Utils/QuaternionUtility.cs')
-rw-r--r-- | Assets/Scripts/Utils/QuaternionUtility.cs | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/Assets/Scripts/Utils/QuaternionUtility.cs b/Assets/Scripts/Utils/QuaternionUtility.cs deleted file mode 100644 index d491b1fe..00000000 --- a/Assets/Scripts/Utils/QuaternionUtility.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public static class QuaternionUtility -{ - - public static Matrix4x4 ToMatrix(ref this Quaternion q) - { - Matrix4x4 m = new Matrix4x4(); - - // Precalculate coordinate products - float x = q.x * 2.0F; - float y = q.y * 2.0F; - float z = q.z * 2.0F; - float xx = q.x * x; - float yy = q.y * y; - float zz = q.z * z; - float xy = q.x * y; - float xz = q.x * z; - float yz = q.y * z; - float wx = q.w * x; - float wy = q.w * y; - float wz = q.w * z; - - // Calculate 3x3 matrix from orthonormal basis - m[0] = 1.0f - (yy + zz); - m[1] = xy + wz; - m[2] = xz - wy; - m[3] = 0.0F; - - m[4] = xy - wz; - m[5] = 1.0f - (xx + zz); - m[6] = yz + wx; - m[7] = 0.0F; - - m[8] = xz + wy; - m[9] = yz - wx; - m[10] = 1.0f - (xx + yy); - m[11] = 0.0F; - - m[12] = 0.0F; - m[13] = 0.0F; - m[14] = 0.0F; - m[15] = 1.0F; - - return m; - } - - -} |