Here is my Irrlicht code for a particle system, where sceneManager
is the scene manager:
irr::scene::IParticleSystemSceneNode *snow = sceneManager->addParticleSystemSceneNode(false, 0, -1, irr::core::vector3df(30, 100, 0));
irr::scene::IParticleEmitter *snowEmitter = snow->createBoxEmitter(irr::core::aabbox3d<irr::f32>(-30, 0, 30, 30, 1, 30), irr::core::vector3df(0, -0.6f, 0), 80, 100, irr::video::SColor(0, 0, 0, 0), irr::video::SColor(0, 255, 255, 255), 600, 1000, 0, irr::core::dimension2df(6, 6), irr::core::dimension2df(8, 8));
snow->setEmitter(snowEmitter);
snowEmitter->drop();
snow->setMaterialFlag(irr::video::EMF_LIGHTING, false);
However, the particles generated by this code fall way too fast, since it's supposed to represent a snowfall. Is there any way to slow it down?
A gravity affector will do the job. In this case, the following code will work:
irr::scene::IParticleAffector *gravity = snow->createGravityAffector(irr::core::vector3df(0, -0.02f, 0), 1);
snow->addAffector(gravity);
gravity->drop();