Particles all spawn from one point

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
hach-que
Posts: 33
Joined: Thu Apr 19, 2007 10:11 am
Location: Australia

Particles all spawn from one point

Post 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.

:(
Last edited by hach-que on Tue Jan 27, 2009 12:03 am, edited 2 times in total.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

But the fire in the special effects example works, right? Can you show some code to demonstrate this problem?
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
hach-que
Posts: 33
Joined: Thu Apr 19, 2007 10:11 am
Location: Australia

Post 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();
Image
Post Reply