Example #1
0
    /// <summary>
    /// Used for writing the data of a CylindricalJoint_Base.
    /// </summary>
    /// <param name="joint"></param>
    /// <param name="writer"></param>
    private static void WriteCylindricalJoint(CylindricalJoint_Base joint, XmlWriter writer)
    {
        writer.WriteStartElement("CylindricalJoint");

        joint.EnforceOrder();

        WriteBXDVector3(joint.basePoint, writer, "BasePoint");
        WriteBXDVector3(joint.axis, writer, "Axis");

        if (joint.hasAngularLimit)
        {
            writer.WriteElementString("AngularLowLimit", joint.angularLimitLow.ToString("F4"));
            writer.WriteElementString("AngularHighLimit", joint.angularLimitHigh.ToString("F4"));
        }

        if (joint.hasLinearStartLimit)
        {
            writer.WriteElementString("LinearStartLimit", joint.linearLimitStart.ToString("F4"));
        }

        if (joint.hasLinearEndLimit)
        {
            writer.WriteElementString("LinearEndLimit", joint.linearLimitEnd.ToString("F4"));
        }
        //writer.WriteElementString("CurrentLinearPosition", joint.currentLinearPosition.ToString("F4"));
        //writer.WriteElementString("CurrentAngularPosition", joint.currentAngularPosition.ToString("F4"));

        writer.WriteElementString("CurrentLinearPosition", joint.currentLinearPosition.ToString("F4"));   // writes the lowest point of the joint to the file as the positon so the joint starts at the bottom, hopefully prevents any weird issues with the joint limits being messed up do to being relative to the start of the joint

        writer.WriteElementString("CurrentAngularPosition", joint.currentAngularPosition.ToString("F4")); // writes the lowest point of the joint to the file as the positon so the joint starts at the bottom, hopefully prevents any weird issues with the joint limits being messed up do to being relative to the start of the joint


        writer.WriteEndElement();
    }
Example #2
0
    /// <summary>
    /// Used for writing the data of a CylindricalJoint_Base.
    /// </summary>
    /// <param name="joint"></param>
    /// <param name="writer"></param>
    private static void WriteCylindricalJoint(CylindricalJoint_Base joint, XmlWriter writer)
    {
        writer.WriteStartElement("CylindricalJoint");

        joint.EnforceOrder();

        WriteBXDVector3(joint.basePoint, writer, "BasePoint");
        WriteBXDVector3(joint.axis, writer, "Axis");

        if (joint.hasAngularLimit)
        {
            writer.WriteElementString("AngularLowLimit", joint.angularLimitLow.ToString("F4"));
            writer.WriteElementString("AngularHighLimit", joint.angularLimitHigh.ToString("F4"));
        }

        if (joint.hasLinearStartLimit)
        {
            writer.WriteElementString("LinearStartLimit", joint.linearLimitStart.ToString("F4"));
        }

        if (joint.hasLinearEndLimit)
        {
            writer.WriteElementString("LinearEndLimit", joint.linearLimitEnd.ToString("F4"));
        }

        writer.WriteElementString("CurrentLinearPosition", joint.currentLinearPosition.ToString("F4"));
        writer.WriteElementString("CurrentAngularPosition", joint.currentAngularPosition.ToString("F4"));

        writer.WriteEndElement();
    }