Пример #1
0
 void attachTransformProperties(TransformTag tag, XmlNode xmlNode)
 {
     attachGeneralProperties(tag, xmlNode);
     tag.position = readVec3(xmlNode, "pos");
     tag.rotation = readVec3(xmlNode, "rot");
     tag.scale    = readFloat(xmlNode, "scale", 1);
 }
Пример #2
0
    private static void enrichXmlWithTransformAttributes(XmlDocument xmlDoc, TransformTag tag, XmlNode node)
    {
        enrichXmlWithGeneralAttributes(xmlDoc, tag, node);
        if (tag.position != null && !$"{tag.position.x} {tag.position.y} {tag.position.z}".Equals("0 0 0"))
        {
            XmlAttribute attribute = xmlDoc.CreateAttribute("pos");
            attribute.Value = $"{tag.position.x} {tag.position.y} {-tag.position.z}".Replace(",", ".");
            node.Attributes.Append(attribute);
        }

        Vector3 rotation = tag.gameObject.transform.localEulerAngles;

        if (Math.Abs(rotation.x) < 0.001)
        {
            rotation.x = 0;
        }
        if (Math.Abs(rotation.y) < 0.001)
        {
            rotation.y = 0;
        }
        if (Math.Abs(rotation.z) < 0.001)
        {
            rotation.z = 0;
        }
        if (rotation != null && !rotation.Equals(Vector3.zero))
        {
            XmlAttribute attribute = xmlDoc.CreateAttribute("rot");
            attribute.Value = $"{-rotation.x} {-rotation.y} {rotation.z}".Replace(",", ".");;
            node.Attributes.Append(attribute);
        }

        if (tag.scale != 1)
        {
            XmlAttribute attribute = xmlDoc.CreateAttribute("scale");
            attribute.Value = tag.scale.ToString().Replace(",", ".");
            node.Attributes.Append(attribute);
        }
    }
Пример #3
0
 private static void HandleTransform(XElement step, Route routeObj, Exchange exchange)
 {
     TransformTag.HandleTransform(step, routeObj, exchange);
 }