Code: Select all
<group name="north_castle_area">
<rotate yaw="90" />
<static name="fortifiedmanor" group="OldTest">
<mesh file="fortifiedmanor.mesh" />
<setting ysnap="relative" />
<position x="7500" y="-612" z="-500" />
<scale x="2.8" y="2.8" z="2.8" />
<rotate pitch="0" yaw="180" />
</static>
</group>
Code: Select all
void Object::saveObject(tinyxml2::XMLDocument *xmlDoc, tinyxml2::XMLElement *elt)
{
tinyxml2::XMLElement *objElt = xmlDoc->NewElement("static");
elt->InsertEndChild(objElt);
objElt->SetAttribute("name", ObjectName.c_str());
objElt->SetAttribute("group", DefaultGroup.c_str());
const Ogre::SceneNode::ObjectIterator it = ObjectNode->getAttachedObjectIterator();
while(it.hasMoreElements())
{
tinyxml2::XMLElement *meshElt = xmlDoc->NewElement("mesh");
objElt->InsertEndChild(meshElt);
Ogre::Entity *entity = static_cast<Entity*>(it.getNext());
meshElt->SetAttribute("file", entity->getMesh()->getName().c_str());
meshElt->SetAttribute("group", entity->getMesh()->getGroup().c_str());
}
tinyxml2::XMLElement *posElt = xmlDoc->NewElement("position");
Ogre::Vector3 pos = ObjectNode->_getDerivedPosition();
posElt->SetAttribute("x", pos.x);
posElt->SetAttribute("y", pos.y);
posElt->SetAttribute("z", pos.z);
objElt->InsertEndChild(posElt);
tinyxml2::XMLElement *rotElt = xmlDoc->NewElement("rotate");
Ogre::Quaternion quat = ObjectNode->getOrientation();
rotElt->SetAttribute("roll", quat.getRoll().valueDegrees());
rotElt->SetAttribute("pitch", quat.getPitch().valueDegrees());
rotElt->SetAttribute("yaw", quat.getYaw().valueDegrees());
objElt->InsertEndChild(rotElt);
tinyxml2::XMLElement *scaleElt = xmlDoc->NewElement("scale");
Ogre::Vector3 scale = ObjectNode->_getDerivedScale();
scaleElt->SetAttribute("x", scale.x);
scaleElt->SetAttribute("y", scale.y);
scaleElt->SetAttribute("z", scale.z);
objElt->InsertEndChild(scaleElt);
}
Code: Select all
<static name="fortifiedmanor" group="OldTest">
<mesh file="fortifiedmanor.mesh" group="OldTest"/>
<position x="-5.00002" y="198.586" z="-75"/>
<rotate roll="180" pitch="0" yaw="-180"/>
<scale x="0.028" y="0.028" z="0.028"/>
</static>
Code: Select all
<static name="fortifiedmanor" group="OldTest">
<mesh file="fortifiedmanor.mesh" group="OldTest"/>
<position x="-5.00002" y="198.586" z="-75"/>
<rotate roll="0" pitch="0" yaw="-90"/>
<scale x="0.028" y="0.028" z="0.028"/>
</static>
Anyway, the object is getting turned upside down.
I have tried different approaches such as using _getDerivedOrientation; as well as adding that or multiplying that with getOrientation.
Thanks.