一,由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);