private void ConvertFrames(Transform trans, ImportedFrame parent) { var frame = new ImportedFrame(); assetsfileList.TryGetGameObject(trans.m_GameObject, out var m_GameObject); frame.Name = m_GameObject.m_Name; frame.InitChildren(trans.m_Children.Count); Quaternion mirroredRotation = new Quaternion(trans.m_LocalRotation[0], trans.m_LocalRotation[1], trans.m_LocalRotation[2], trans.m_LocalRotation[3]); mirroredRotation.Y *= -1; mirroredRotation.Z *= -1; var m_LocalScale = new Vector3(trans.m_LocalScale[0], trans.m_LocalScale[1], trans.m_LocalScale[2]); var m_LocalPosition = new Vector3(trans.m_LocalPosition[0], trans.m_LocalPosition[1], trans.m_LocalPosition[2]); frame.Matrix = Matrix.Scaling(m_LocalScale) * Matrix.RotationQuaternion(mirroredRotation) * Matrix.Translation(-m_LocalPosition.X, m_LocalPosition.Y, m_LocalPosition.Z); if (parent == null) { FrameList = new List <ImportedFrame>(); FrameList.Add(frame); } else { parent.AddChild(frame); } foreach (var pptr in trans.m_Children) { if (assetsfileList.TryGetTransform(pptr, out var child)) { ConvertFrames(child, frame); } } }
private ImportedFrame ConvertFrame(Vector3 t, Quaternion q, Vector3 s, string name) { var frame = new ImportedFrame(); frame.Name = name; frame.InitChildren(0); SetFrame(frame, t, q, s); return(frame); }
private ImportedFrame ConvertFrame(Transform trans) { var frame = new ImportedFrame(); trans.m_GameObject.TryGetGameObject(out var m_GameObject); frame.Name = m_GameObject.m_Name; frame.InitChildren(trans.m_Children.Count); var m_EulerRotation = QuatToEuler(new[] { trans.m_LocalRotation[0], -trans.m_LocalRotation[1], -trans.m_LocalRotation[2], trans.m_LocalRotation[3] }); frame.LocalRotation = new[] { m_EulerRotation[0], m_EulerRotation[1], m_EulerRotation[2] }; frame.LocalScale = new[] { trans.m_LocalScale[0], trans.m_LocalScale[1], trans.m_LocalScale[2] }; frame.LocalPosition = new[] { -trans.m_LocalPosition[0], trans.m_LocalPosition[1], trans.m_LocalPosition[2] }; return frame; }
private ImportedFrame ConvertFrame(Transform trans, string name) { var frame = new ImportedFrame(); frame.Name = name; frame.InitChildren(0); var m_EulerRotation = QuatToEuler(new[] { trans.m_LocalRotation[0], -trans.m_LocalRotation[1], -trans.m_LocalRotation[2], trans.m_LocalRotation[3] }); frame.LocalRotation = new[] { m_EulerRotation[0], m_EulerRotation[1], m_EulerRotation[2] }; frame.LocalScale = new[] { trans.m_LocalScale[0], trans.m_LocalScale[1], trans.m_LocalScale[2] }; frame.LocalPosition = new[] { -trans.m_LocalPosition[0], trans.m_LocalPosition[1], trans.m_LocalPosition[2] }; return(frame); }
private ImportedFrame ConvertFrame(Vector3 t, Quaternion q, Vector3 s, string name) { var frame = new ImportedFrame(); frame.Name = name; frame.InitChildren(0); var m_LocalPosition = new[] { t.X, t.Y, t.Z }; var m_LocalRotation = new[] { q.X, q.Y, q.Z, q.W }; var m_LocalScale = new[] { s.X, s.Y, s.Z }; var m_EulerRotation = QuatToEuler(new[] { m_LocalRotation[0], -m_LocalRotation[1], -m_LocalRotation[2], m_LocalRotation[3] }); frame.LocalRotation = new[] { m_EulerRotation[0], m_EulerRotation[1], m_EulerRotation[2] }; frame.LocalScale = new[] { m_LocalScale[0], m_LocalScale[1], m_LocalScale[2] }; frame.LocalPosition = new[] { -m_LocalPosition[0], m_LocalPosition[1], m_LocalPosition[2] }; return frame; }
private ImportedFrame ConvertFrames(Transform trans) { var frame = new ImportedFrame(); assetsfileList.TryGetGameObject(trans.m_GameObject, out var m_GameObject); frame.Name = m_GameObject.m_Name; frame.InitChildren(trans.m_Children.Count); Quaternion mirroredRotation = new Quaternion(trans.m_LocalRotation[0], trans.m_LocalRotation[1], trans.m_LocalRotation[2], trans.m_LocalRotation[3]); mirroredRotation.Y *= -1; mirroredRotation.Z *= -1; var m_LocalScale = new Vector3(trans.m_LocalScale[0], trans.m_LocalScale[1], trans.m_LocalScale[2]); var m_LocalPosition = new Vector3(trans.m_LocalPosition[0], trans.m_LocalPosition[1], trans.m_LocalPosition[2]); frame.Matrix = Matrix.Scaling(m_LocalScale) * Matrix.RotationQuaternion(mirroredRotation) * Matrix.Translation(-m_LocalPosition.X, m_LocalPosition.Y, m_LocalPosition.Z); return(frame); }