public override void LoadData(ref AnimatTools.DataObjects.Simulation dsSim, ref AnimatTools.DataObjects.Physical.PhysicalStructure doStructure, ref AnimatTools.Interfaces.StdXml oXml) { base.LoadData (ref dsSim, ref doStructure, ref oXml); oXml.IntoElem(); oXml.IntoChildElement("Constraint"); m_fltMinAngle = oXml.GetAttribFloat("Low"); m_fltMaxAngle = oXml.GetAttribFloat("High"); oXml.OutOfElem(); //out of Constraint m_snMinAngle.SetFromValue(Util.RadiansToDegrees(m_fltMinAngle), AnimatTools.Framework.ScaledNumber.enumNumericScale.None); m_snMaxAngle.SetFromValue(Util.RadiansToDegrees(m_fltMaxAngle), AnimatTools.Framework.ScaledNumber.enumNumericScale.None); m_bEnableMotor = oXml.GetChildBool("EnableMotor"); m_bServoMotor = oXml.GetChildBool("ServoMotor", m_bServoMotor); m_fltServoGain = oXml.GetChildFloat("ServoGain", m_fltServoGain); //based on whether this is a servo motor or not the incoming data type will change. if(m_bServoMotor) m_thIncomingDataType = new AnimatTools.DataObjects.DataType("Position", "Position", "rad", "rad", -3.142, 3.142, ScaledNumber.enumNumericScale.None, ScaledNumber.enumNumericScale.None); else m_thIncomingDataType = new AnimatTools.DataObjects.DataType("DesiredVelocity", "Desired Velocity", "m/s", "m/s", -5, 5, ScaledNumber.enumNumericScale.None, ScaledNumber.enumNumericScale.None); if(oXml.FindChildElement("MaxTorque", false)) m_snMaxTorque.LoadData(ref oXml, "MaxTorque"); if(oXml.FindChildElement("MaxVelocity", false)) m_snMaxTorque.LoadData(ref oXml, "MaxVelocity"); // if(oXml.FindChildElement("RotationAxis", false)) // { // Vec3d vTmp = Util.LoadVec3d(ref oXml, "RotationAxis", this); // m_v3Axis = new Vector3((float)vTmp.X, (float)vTmp.Y, (float)vTmp.Z); // } m_v3Axis = new Vector3(0,0,1); oXml.OutOfElem(); //out of body }
public override void LoadData(ref AnimatTools.DataObjects.Simulation dsSim, ref AnimatTools.DataObjects.Physical.PhysicalStructure doStructure, ref AnimatTools.Interfaces.StdXml oXml) { base.LoadData (ref dsSim, ref doStructure, ref oXml); oXml.IntoElem(); m_fLowerRadius = oXml.GetChildFloat("LowerRadius"); m_fUpperRadius = oXml.GetChildFloat("UpperRadius"); m_fHeight = oXml.GetChildFloat("Height"); m_snHeight.ActualValue = m_fHeight; oXml.OutOfElem(); //out of body }
public override void LoadData(ref AnimatTools.DataObjects.Simulation dsSim, ref AnimatTools.DataObjects.Physical.PhysicalStructure doStructure, ref AnimatTools.Interfaces.StdXml oXml) { base.LoadData (ref dsSim, ref doStructure, ref oXml); oXml.IntoElem(); m_fHalfAngle = oXml.GetChildFloat("ConstraintHalfAngle"); Vec3d v = Util.LoadVec3d(ref oXml,"ConstraintAxis",null); // this.Damping.ActualValue = oXml.GetChildFloat("Damping"); // this.Stiffness.ActualValue = oXml.GetChildFloat("Stiffness"); this.m_v3Rotation.X = (float)v.X; this.m_v3Rotation.Y = (float)v.Y; this.m_v3Rotation.Z = (float)v.Z; oXml.OutOfElem(); }
public override void LoadData(ref AnimatTools.DataObjects.Simulation dsSim, ref AnimatTools.DataObjects.Physical.PhysicalStructure doStructure, ref AnimatTools.Interfaces.StdXml oXml) { base.LoadData (ref dsSim, ref doStructure, ref oXml); oXml.IntoElem(); if(oXml.FindChildElement("Constraint", false)) { oXml.IntoChildElement("Constraint"); m_fltMinMovement = oXml.GetAttribFloat("Low"); m_fltMaxMovement = oXml.GetAttribFloat("High"); oXml.OutOfElem(); //out of Constraint } m_fltLength = oXml.GetChildFloat("Length", m_fltLength); m_bEnableMotor = oXml.GetChildBool("EnableMotor", false); m_bServoMotor = oXml.GetChildBool("ServoMotor", m_bServoMotor); m_fltServoGain = oXml.GetChildFloat("ServoGain", m_fltServoGain); if(oXml.FindChildElement("MaxForce", false)) m_snMaxForce.LoadData(ref oXml, "MaxForce"); if(oXml.FindChildElement("MaxVelocity", false)) m_snMaxVelocity.LoadData(ref oXml, "MaxVelocity"); oXml.OutOfElem(); //out of body }
public override void LoadData(ref AnimatTools.DataObjects.Simulation dsSim, ref AnimatTools.DataObjects.Physical.PhysicalStructure doStructure, ref AnimatTools.Interfaces.StdXml oXml) { m_aryChildBodies.Clear(); oXml.IntoElem(); //'Into RigidBody Element m_strID = oXml.GetChildString("ID"); m_strName = oXml.GetChildString("Name", m_strID); m_bVisible = oXml.GetChildBool("IsVisible", m_bVisible); if(m_strID.Trim().Length == 0) m_strID = System.Guid.NewGuid().ToString(); if(m_strName.Trim().Length == 0) m_strName = m_strID; if(oXml.FindChildElement("Color", false)) { System.Drawing.Color oColor = Util.LoadColor(ref oXml, "Color"); this.Alpha = oColor.A; this.Color = oColor; } m_fRadius = oXml.GetChildFloat("Radius", m_fRadius); //m_fHeight = oXml.GetChildFloat("Height", m_fHeight); if(oXml.FindChildElement("Direction",false)) { this.m_v3Direction = new Vector3(); Vec3d vDirection = Util.LoadVec3d(ref oXml, "Direction", this); m_v3Direction.X = (float)vDirection.X; m_v3Direction.Y = (float)vDirection.Y; m_v3Direction.Z = (float)vDirection.Z; } if(oXml.FindChildElement("OrientationMatrix", false)) { m_mtxOrientation = Util_DX.LoadMatrix(ref oXml, "OrientationMatrix"); m_v3Rotation = Util_DX.DecomposeXYZRotationMatrix(Orientation); this.Rotation = new Vec3d(null,Geometry.RadianToDegree(m_v3Rotation.X),Geometry.RadianToDegree(m_v3Rotation.Y),Geometry.RadianToDegree(m_v3Rotation.Z)); } if(oXml.FindChildElement("TranslationMatrix",false)) m_mtxTranslation = Util_DX.LoadMatrix(ref oXml,"TranslationMatrix"); oXml.OutOfElem(); //Outof RigidBody Element }
public override void LoadData(ref AnimatTools.Interfaces.StdXml oXml) { base.LoadData(ref oXml); oXml.IntoElem(); if(oXml.FindChildElement("PrimaryAttachmentID", false)) { string strAttachID = oXml.GetChildString("PrimaryAttachmentID"); if(m_doStructure != null && strAttachID.Trim().Length > 0) { AnimatTools.DataObjects.Physical.BodyPart rbPart = (AnimatTools.DataObjects.Physical.BodyPart) m_doStructure.FindBodyPart(strAttachID, false); if(rbPart != null) m_thPrimaryAttachment = new AnimatTools.TypeHelpers.LinkedBodyPartList(m_doStructure, rbPart, m_tpBodyPartType); } } else m_thPrimaryAttachment = new AnimatTools.TypeHelpers.LinkedBodyPartList(m_doStructure, null, m_tpBodyPartType); if(oXml.FindChildElement("SecondaryAttachmentID", false)) { string strAttachID = oXml.GetChildString("SecondaryAttachmentID"); if(m_doStructure != null && strAttachID.Trim().Length > 0) { AnimatTools.DataObjects.Physical.BodyPart rbPart = (AnimatTools.DataObjects.Physical.BodyPart) m_doStructure.FindBodyPart(strAttachID, false); if(rbPart != null) m_thSecondaryAttachment = new AnimatTools.TypeHelpers.LinkedBodyPartList(m_doStructure, rbPart, m_tpBodyPartType); } } else m_thSecondaryAttachment = new AnimatTools.TypeHelpers.LinkedBodyPartList(m_doStructure, null, m_tpBodyPartType); m_fltProportionalGain = oXml.GetChildFloat("PGain", m_fltProportionalGain); m_fltDerivativeGain = oXml.GetChildFloat("DGain", m_fltDerivativeGain); m_fltIntegratorGain = oXml.GetChildFloat("IGain", m_fltIntegratorGain); m_fltMaxIntegratorValue = oXml.GetChildFloat("MaxIValue", m_fltMaxIntegratorValue); m_snVelocity.LoadData(ref oXml, "Velocity"); m_snMaxForce.LoadData(ref oXml, "MaxForce"); SetPositionUnits(); oXml.OutOfElem(); }
public override void LoadData(ref AnimatTools.Interfaces.StdXml oXml) { m_fltPanX = oXml.GetChildFloat("PanX", m_fltPanX); m_fltPanY = oXml.GetChildFloat("PanY", m_fltPanY); m_fltZoom = oXml.GetChildFloat("Zoom", m_fltZoom); m_fltRotateX = oXml.GetChildFloat("RotateX", m_fltRotateX); m_fltRotateY = oXml.GetChildFloat("RotateY", m_fltRotateY); if(oXml.FindChildElement("RotateZ", false)) m_fltRotateZ = oXml.GetChildFloat("RotateZ", m_fltRotateZ); else m_fltRotateZ = 0; m_mtxOrientation = Matrix.RotationX(m_fltRotateX) * Matrix.RotationY(m_fltRotateY) * Matrix.RotationZ(m_fltRotateZ); if(oXml.FindChildElement("BackColor", false)) m_clBackColor = Util.LoadColor(ref oXml, "BackColor"); }
public override void LoadData(ref AnimatTools.DataObjects.Simulation dsSim, ref AnimatTools.DataObjects.Physical.PhysicalStructure doStructure, ref AnimatTools.Interfaces.StdXml oXml) { base.LoadData (ref dsSim, ref doStructure, ref oXml); oXml.IntoElem(); m_fltHeight = oXml.GetChildFloat("Height", m_fltHeight); m_strHeightFieldImage = oXml.GetChildString("HeightFieldImage", m_strHeightFieldImage); if(oXml.FindChildElement("MapLocation", false)) m_vMapLocation = Util.LoadVec3d(ref oXml, "MapLocation", this); if(oXml.FindChildElement("MapSize", false)) m_vMapSize = Util.LoadVec3d(ref oXml, "MapSize", this); m_fltMapScale = oXml.GetChildFloat("MapScale", m_fltMapScale); oXml.OutOfElem(); //out of body }