I tried,
Code: Select all
class Particles{
public:
Particles( String name,String psys,Bone *attach){
rSys = ParticleSystemManager::getSingleton().createSystem( name,psys );
node = gsmgr->getRootSceneNode()->createChildSceneNode();
node->attachObject( rSys );
bone = attach;
};
Particles( String name,String psys,SceneNode* parent=NULL){
rSys = ParticleSystemManager::getSingleton().createSystem( name,psys );
if(parent==NULL){
node = gsmgr->getRootSceneNode()->createChildSceneNode();
}else{
node = parent->createChildSceneNode();
};
node->attachObject( rSys );
};
~Particles(){
};
void update(){
if(bone!=NULL){
node->setOrientation( bone->getWorldOrientation() );
node->setPosition( bone->getWorldPosition() );
};
};
void AttachTo( SceneNode *aTo){
// aTo->attachObject( node );
};
void AttachSub( SceneNode *aSub){
// node->attachObject( aSub );
};
private:
SceneNode *node;
ParticleSystem* rSys;
Bone *bone;
};
The result is although the particle system seems to rotate as the bone does, it doesn't match or appear to be in sync.
Also, the set position has no effect, it stays isolated at 0,0,0 where the bone starts.
The bone in question being joint10 of the robot mesh.
Any ideas?
Is it not possible to attach a scene node to a bone so the particle system it's self is updated by the engine instead of the manual code I'm using?