I USE OSG IN QT (whith visual c++ 2010), BUT THE FIRE AND SMOKE (PARTICLE) 
don't move with the model , i use this code to create these effects: 
//to get the intersection with the terrin
osg::Vec3 posCallback::getCurrentPosition()
{
        osg::Vec3d pos(0,0,0);
        
mapNode->getTerrain()->getWorldCoordsUnderMouse(view,Xpos,Ypos,pos);//pos is 
vector
        return pos;
}

//create the effect
osg::Node* createExplode(osg::Vec3 a)  
{  
    osg::Group* explode = new osg::Group() ;  
    osg::Vec3 wind(1.0f,0.0f,0.0f);    
    osg::Vec3 position=a;    
       
    osgParticle::ExplosionEffect* explosion = new 
osgParticle::ExplosionEffect(position, 14.0f,11);  
    osgParticle::ExplosionDebrisEffect* explosionDebri = new 
osgParticle::ExplosionDebrisEffect(position, 4.0f,11);      
    osgParticle::SmokeEffect* smoke = new osgParticle::SmokeEffect(position, 
100000.0f,7);  
    osgParticle::FireEffect* fire = new osgParticle::FireEffect(position, 
1000.0f,3);  
       
        fire->setEmitterDuration(smoke->getEmitterDuration());
        fire->setParticleDuration(smoke->getParticleDuration());
       
    explosion->setWind(wind);  
    explosionDebri->setWind(wind);  
    smoke->setWind(wind);  
    //fire->setWind(wind);  
         
    explode->addChild(explosion);  
    explode->addChild(explosionDebri);  
    explode->addChild(smoke);  
    explode->addChild(fire);  
       
    return explode ;  
}  
//add the model and the smoke+fire  to the position transform to move theme 
together:
post=new osg::PositionAttitudeTransform();
root->addChild(post);
post->addChild( model3D ); //osg::Node at 0,0,0
post->addChild(createExplode(osg::Vec3(0,0,0) );//at the center 0,0,0
post->setPosition(getCurrentPosition());
//I add some animation (of position) to the post

//but when the model change its position the fire and smoke don't change thiere 
position, they still in the center

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=48613#48613





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to