Page 1 of 1

Particles all spawn from one point

Posted: Thu Jan 22, 2009 5:24 am
by hach-que
I've tried box, sphere and ring particle emitters, however no matter what settings I give them, they always generate particles at a single point.

What's even weirder is, I added:

Code: Select all

printf("Box minedge is %f,%f,%f.",Box.MinEdge.X,Box.MinEdge.Y,Box.MinEdge.Z);
to the box particle emitter to find out if it was getting the arguments properly and sure enough, the box emitter had a minimum edge of -100,-100,-100 which is what I passed in Lua (I've manually binded irrlicht to Lua).

I have modified Irrlicht but I haven't touched the particle systems (I added userdata to IReferenceCounted and shadow volume nodes to basic objects).

UPDATE
After discussing it on IRC, we still haven't found the problem, but we've narrowed it down. The Irrlicht box emitter is pushing particles onto the Particles array, but when the particle system is retrieving them, they have all screwed up values.

The Irrlicht example works absolutely fine.

:(

Posted: Thu Jan 22, 2009 10:39 pm
by bitplane
But the fire in the special effects example works, right? Can you show some code to demonstrate this problem?

Posted: Fri Jan 23, 2009 12:38 am
by hybrid
I've also checked several of the new emitters, which all work as expected. However, there's still a problem with the randomizer and the modf function. But that wouldn't show up like the mentioned problem, at least not in general.

Posted: Sat Jan 24, 2009 4:47 am
by hach-que
UPDATE
After discussing it on IRC, we still haven't found the problem, but we've narrowed it down. The Irrlicht box emitter is pushing particles onto the Particles array, but when the particle system is retrieving them, they have all screwed up values.

The Irrlicht example works absolutely fine.

:(

-------------------------------------------

Well I compiled the fire example with the modified example, and it works fine >_>

I really have no idea what is causing this, but this is effective code (technically it goes through Lua):

In the scene manager create function:

Code: Select all

irr::scene::IParticleSystemSceneNode* inode = scn->addParticleSystemSceneNode(false,0,id,position,rotation,size);
inode->updateAbsolutePosition();
In the particle emitter create box function:

Code: Select all

irr::scene::IParticleBoxEmitter* em = extended_self->createBoxEmitter(
				area->getObject(),
				direction->getObject(),
				minParticlesPerSecond,
				maxParticlesPerSecond,
				minStartColor->getObject(),
				maxStartColor->getObject(),
				lifeTimeMin,
				lifeTimeMax,
				maxAngleDegrees,
				minStartSize->getObjectAsDimension(),
				maxStartSize->getObjectAsDimension());
		em->setBox(area->getObject());

		extended_self->setEmitter(em);
		em->drop();

		irr::scene::IParticleAffector* paf = extended_self->createFadeOutParticleAffector();
        extended_self->addAffector(paf);
        paf->drop();