Here's how I'm creating/attaching the particle system:
Code: Select all
Ogre::ParticleSystem* DotSceneLoader::processParticleSystem(TiXmlElement *XMLNode, SceneNode *parentNode, Item *parentItem)
{
Ogre::Bone *bone = NULL;
Ogre::ParticleSystem* ps = 0;
// Process other attributes
String boneName = getAttrib(XMLNode, "attach_bone");
// see if we have a bone to process
if(boneName != "")
{
// get a reference to the bone through the parent's skeleton
Ogre::SkeletonInstance *skeletonInstance = parentItem->getSkeletonInstance();
Ogre::IdString boneId = Ogre::IdString(boneName);
bone = skeletonInstance->getBone(boneId);
}
// Process particle systems
TiXmlElement *pElement = XMLNode->FirstChildElement("system");
while(pElement)
{
std::string systemName = getAttrib(pElement, "name");
ps = mSceneMgr->createParticleSystem(systemName);
ps->setRenderQueueGroup(mDefaultRenderQueue+1);
parentNode->setStatic(false);
if(bone) {
// get a tag point and attach it
Ogre::TagPoint *tagPoint = mSceneMgr->createTagPoint();
tagPoint->attachObject(ps);
tagPoint->_getFullTransformUpdated();
// add the tag point to the bone
bone->addTagPoint(tagPoint);
} else {
parentNode->attachObject(ps);
}
ps->setVisible(true);
pElement = pElement->NextSiblingElement("system");
}
return ps;
}
Thanks for any help you can give!