void Update() { pos = new Vec3(transform.position.x, transform.position.y, transform.position.z); rot = new Quaternion(transform.rotation.x, transform.rotation.y, transform.rotation.z, transform.rotation.w); sca = new Vec3(transform.localScale.x, transform.localScale.y, transform.localScale.z); mT = Xirtam4x4.Translate(pos); mR = Xirtam4x4.Rotate(rot); mS = Xirtam4x4.Scale(sca); mTRS = Xirtam4x4.TRS(pos, rot, sca); t0 = new Vector4(mT.m00, mT.m01, mT.m02, mT.m03); t1 = new Vector4(mT.m10, mT.m11, mT.m12, mT.m13); t2 = new Vector4(mT.m20, mT.m21, mT.m22, mT.m23); t3 = new Vector4(mT.m30, mT.m31, mT.m32, mT.m33); r0 = new Vector4(mR.m00, mR.m01, mR.m02, mR.m03); r1 = new Vector4(mR.m10, mR.m11, mR.m12, mR.m13); r2 = new Vector4(mR.m20, mR.m21, mR.m22, mR.m23); r3 = new Vector4(mR.m30, mR.m31, mR.m32, mR.m33); s0 = new Vector4(mS.m00, mS.m01, mS.m02, mS.m03); s1 = new Vector4(mS.m10, mS.m11, mS.m12, mS.m13); s2 = new Vector4(mS.m20, mS.m21, mS.m22, mS.m23); s3 = new Vector4(mS.m30, mS.m31, mS.m32, mS.m33); trs0 = new Vector4(mTRS.m00, mTRS.m01, mTRS.m02, mTRS.m03); trs1 = new Vector4(mTRS.m10, mTRS.m11, mTRS.m12, mTRS.m13); trs2 = new Vector4(mTRS.m20, mTRS.m21, mTRS.m22, mTRS.m23); trs3 = new Vector4(mTRS.m30, mTRS.m31, mTRS.m32, mTRS.m33); }
private void OnGUI() { target = EditorGUILayout.ObjectField(target, typeof(GameObject), true) as GameObject; if (target != null) { target.transform.position = EditorGUILayout.Vector3Field("Position: ", target.transform.position); target.transform.rotation = Quaternion.Euler(EditorGUILayout.Vector3Field("Rotation: ", target.transform.rotation.eulerAngles)); target.transform.localScale = EditorGUILayout.Vector3Field("Scale: ", target.transform.localScale); style.fontSize = 15; EditorGUILayout.Space(20); EditorGUILayout.LabelField("Translation matrix", style); DrawMatrix(Xirtam4x4.Translate(target.transform.position)); EditorGUILayout.Space(20); EditorGUILayout.LabelField("Rotation matrix", style); DrawMatrix(Xirtam4x4.Rotate(target.transform.rotation)); EditorGUILayout.Space(20); EditorGUILayout.LabelField("Scale matrix", style); DrawMatrix(Xirtam4x4.Scale(target.transform.localScale)); EditorGUILayout.Space(20); EditorGUILayout.LabelField("TRS matrix", style); DrawMatrix(Xirtam4x4.TRS(target.transform.position, target.transform.rotation, target.transform.localScale)); } }