animationgisparticle-systemopenscenegraph

a Simple Example of OpenSceneGraph particles


i'm learning osg and getting a little confused about particles. i need something like a "car model" that is animated and i want to attach fire particle to it's Exhaust.

in every try the fire particle is not attached to model. its just fixed in a location and model goes out. i would be happy if you share me a sample code or any example. i didn't find any example on the internet.

this is my code that I'm making a ball and animating. adding a fire Particle to it:

osg::Geode *ball = new osg::Geode;
ball->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(50.0f,50.0f,10.0f),5.0)));
osg::ref_ptr<osgParticle::FireEffect> mFire;
mFire = new osgParticle::FireEffect(ball->getBound().center(),10,50);
/// ///////////////////////////////////////////////////////////////////
ball->addChild(mFire);
node->addChild(ball);
callback->start();
node->setUpdateCallback(callback);
return node;


node is a <positionAttitudeTransform>

thanks alot.


Solution

  • You have to attach the emitter to the "car" transform but the actual particles to the world.