标签:
一,由Matrix4x4提取Quaternion和Vector3
Quaternion getRotationFromMatrix(Matrix4x4 m) {
return Quaternion.LookRotation(m.GetColumn(2), m.GetColumn(1));
}
Vector3 getPositionFromMatrix(Matrix4x4 m){
return m.GetColumn (3);
}
二,由Quaternion,Vector3构造Matrix4x4
Vector3 position=...
Quaternion rotation=...
Vector3 scale=...//for example: scale=Vector3.one
Matrix4x4 m = Matrix4x4.TRS (position, rotation, scale);
unity, 由Matrix4x4提取Quaternion和Vector3 及 由Quaternion,Vector3构造Matrix4x4
标签:
原文地址:http://www.cnblogs.com/wantnon/p/4582262.html