public override void SaveData(ref AnimatTools.DataObjects.Simulation dsSim, ref AnimatTools.DataObjects.Physical.PhysicalStructure doStructure, ref AnimatTools.Interfaces.StdXml oXml) { base.SaveData (ref dsSim, ref doStructure, ref oXml); oXml.IntoElem(); RigidBodies.RigidBody_DX rbParent = (RigidBodies.RigidBody_DX)this.Parent; Vector3 v3Rot = Util_DX.DecomposeXYZRotationMatrix(this.CombinedTransformationMatrix);; float x = Geometry.DegreeToRadian(180); if(!oXml.FindChildElement("Constraint", false)) oXml.AddChildElement("Constraint"); oXml.IntoElem(); oXml.SetAttrib("Low",this.m_fltMinAngle); oXml.SetAttrib("High", this.m_fltMaxAngle); oXml.OutOfElem(); oXml.AddChildElement("EnableMotor",this.m_bEnableMotor); oXml.AddChildElement("ServoMotor",this.m_bServoMotor); oXml.AddChildElement("ServoGain",this.m_fltServoGain); m_snMaxTorque.SaveData(ref oXml, "MaxTorque"); m_snMaxVelocity.SaveData(ref oXml, "MaxVelocity"); // if(v3Rot.Y >= 180) // m_v3Axis.TransformCoordinate(/*Matrix.RotationX(Geometry.DegreeToRadian(180))* Matrix.RotationY(Geometry.DegreeToRadian(180)) * Matrix.RotationZ(Geometry.DegreeToRadian(180)) **/ Matrix.RotationX(v3Rot.X)* Matrix.RotationY(v3Rot.Y) * Matrix.RotationZ(v3Rot.Z)); // else //m_v3Axis.TransformCoordinate(Matrix.RotationX(Geometry.DegreeToRadian(180)) * Matrix.RotationY(Geometry.DegreeToRadian(180)) * Matrix.RotationZ(Geometry.DegreeToRadian(180)) * Matrix.RotationX(v3Rot.X)* Matrix.RotationY(v3Rot.Y) * Matrix.RotationZ(v3Rot.Z)); Matrix m = this.CombinedTransformationMatrix; m.M41 = 0; m.M42 = 0; m.M43 = 0; //Quaternion q = Quaternion.RotationYawPitchRoll(v3Rot.Y, v3Rot.X, v3Rot.Z); //m_v3Axis.TransformCoordinate(Matrix.RotationQuaternion(q)); m_v3Axis.TransformCoordinate(m); //Vec3d vRotationAxis = new Vec3d(null,1, 0, 0); Vec3d vRotationAxis = new Vec3d(null,m_v3Axis.X, m_v3Axis.Y, m_v3Axis.Z); Util.SaveVector(ref oXml, "RotationAxis", vRotationAxis); oXml.OutOfElem(); m_v3Axis = new Vector3(0,0,1); }
public override void SaveData(ref AnimatTools.DataObjects.Simulation dsSim, ref AnimatTools.DataObjects.Physical.PhysicalStructure doStructure, ref AnimatTools.Interfaces.StdXml oXml) { base.SaveData (ref dsSim, ref doStructure, ref oXml); oXml.IntoElem(); if(!oXml.FindChildElement("Constraint", false)) oXml.AddChildElement("Constraint"); oXml.IntoElem(); oXml.SetAttrib("Low",this.m_fltMinMovement); oXml.SetAttrib("High", this.m_fltMaxMovement); oXml.OutOfElem(); oXml.AddChildElement("Length", m_fltLength); oXml.AddChildElement("EnableMotor",this.m_bEnableMotor); oXml.AddChildElement("ServoMotor",this.m_bServoMotor); oXml.AddChildElement("ServoGain",this.m_fltServoGain); m_snMaxForce.SaveData(ref oXml, "MaxForce"); m_snMaxVelocity.SaveData(ref oXml, "MaxVelocity"); RigidBodies.RigidBody_DX rbParent = (RigidBodies.RigidBody_DX)this.Parent; Vector3 v3Rot = Util_DX.DecomposeXYZRotationMatrix(this.CombinedTransformationMatrix);; float x = Geometry.DegreeToRadian(180); m_v3Axis.TransformCoordinate(Matrix.RotationX(Geometry.DegreeToRadian(180)) * Matrix.RotationY(Geometry.DegreeToRadian(180)) * Matrix.RotationZ(Geometry.DegreeToRadian(180)) * Matrix.RotationX(v3Rot.X)* Matrix.RotationY(v3Rot.Y) * Matrix.RotationZ(v3Rot.Z)); Vec3d vRotationAxis = new Vec3d(null,m_v3Axis.X, m_v3Axis.Y, m_v3Axis.Z); Util.SaveVector(ref oXml, "RotationAxis", vRotationAxis); m_v3Axis = new Vector3(0,0,1); oXml.OutOfElem(); }