fix emotion rotation.

This commit is contained in:
左右看
2022-09-18 23:30:00 +08:00
parent a97613aff1
commit 7e3460991a
3 changed files with 44 additions and 6 deletions
+27
View File
@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotationConvert : MonoBehaviour
{
public static Quaternion fromMaya(Vector3 euler_angle)
{
euler_angle.x *= Mathf.Deg2Rad;
euler_angle.y *= Mathf.Deg2Rad;
euler_angle.z *= Mathf.Deg2Rad;
float c = Mathf.Cos(euler_angle[0] / 2);
float d = Mathf.Cos(euler_angle[1] / 2);
float e = Mathf.Cos(euler_angle[2] / 2);
float f = Mathf.Sin(euler_angle[0] / 2);
float g = Mathf.Sin(euler_angle[1] / 2);
float h = Mathf.Sin(euler_angle[2] / 2);
float x = f * d * e - c * g * h;
float y = c * g * e + f * d * h;
float z = c * d * h - f * g * e;
float w = c * d * e + f * g * h;
return new Quaternion(x, y, z, w);
}
}