Adding a particle emittor as child ???

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
exal
Posts: 60
Joined: Tue Feb 24, 2004 9:05 am

Adding a particle emittor as child ???

Post by exal »

Hi I am trying to attach the emittor as a child to have it automatically follow the object. If I use the emittor directly it works fine. But if I do myNode->addChild(ps) it will not show up. Why is that ?

Code: Select all

irr::scene::IParticleSystemSceneNode* ps = 0;
	ps = GameMain::GetInstance()->GetIrrDevice()->getSceneManager()->addParticleSystemSceneNode(false, myNode);
	ps->setPosition(irr::core::vector3df(0,0,0));
	ps->setScale(irr::core::vector3df(1,1,1));
	myNode->addChild(ps);
	

	ps->setParticleSize(irr::core::dimension2d<irr::f32>(0.1f, 0.1f));

	irr::scene::IParticleEmitter* em = ps->createPointEmitter();
		ps->setEmitter(em);
	em->drop();

	irr::scene::IParticleAffector* paf = 
		ps->createFadeOutParticleAffector();

	ps->addAffector(paf);
	paf->drop();

	ps->setMaterialFlag(irr::video::EMF_LIGHTING, false);
	ps->setMaterialTexture(0, GameMain::GetInstance()->GetIrrDevice()->getVideoDriver()->getTexture("data/particle.tga"));
	ps->setMaterialType(irr::video::EMT_TRANSPARENT_VERTEX_ALPHA);
Post Reply