Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 10. Creating Eye Candy Effects w... > Time for action - adding a particle ...

Time for action - adding a particle system in Irrlicht

Now, let's get started with coding. To create a particle system in Irrlicht, we can use the following procedure:

  1. First we'll add a particle system to our scene.

    IParticleSystemSceneNode* ps = smgr- >addParticleSystemSceneNode(false);
    
  2. Next, we'll create an emitter to emit that particle.

    IParticleEmitter* em = ps->createBoxEmitter(
    aabbox3d<f32>(-5, 0, -5, 5, 1, 5),
    vector3df(0.0f, 0.1f, 0.0f),
    50, 200,
    SColor(0, 0, 0, 255),
    SColor(0, 255, 255, 255),
    800, 1000, 0,
    dimension2df(10.f, 10.f),
    dimension2df(20.f, 20.f));
    
  3. Set the emitter to the particle system we just created and release the emitter since we've already set it to our particle.

    ps->setEmitter(em);
    em->drop();
    
  4. Set the particle system properties.

    ps->setPosition(vector3df(-70, 60, 40));
    ps->setScale(vector3df(2, 2, 2));
    ps->setMaterialFlag(EMF_LIGHTING, false);
    ps->setMaterialFlag(EMF_ZWRITE_ENABLE, false);
    ps->setMaterialTexture(0, driver- >getTexture("../../media/fireball.bmp"));
    ps->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
    

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial