This project is read-only.

Particle Emittors attached to a mesh

Nov 2, 2009 at 11:56 PM

Hi StatusUnknown,

Could you tell me if the integrated Particle System allows us to attach Emittors to a local space such as a ModelInstance Mesh or is it only for scenes?

I'm a bit disturbed by the xml files. :)



Nov 10, 2009 at 12:25 AM

Hi phil, apologies for taking some time to reply. I've been very busy at work and the like :-)

The first part is getting the matrix for the part of the mesh you are interested in. Luckily, this is already demonstrated in code - so it's not going to be too hard. Check out tut. 12, this shows how things are done. So for example if you want to emit particles from the hand of a character, this would be how to get the position. (Actually, if you just want to emit from the characters position, ignore this :-)

It depends on how you want the particle system to function.
There are four ways to do it, with pros/cons.

If you want to have an instance of the particle system attached to a character (if the character moves, *all* particles move with the character - ie, it won't leave a trail behind it) then simply set the world matrix before drawing the particle drawer. This is how the fire / smoke instances are drawn in the ring of fire in tut. 23.

If you need the particles to trail behind the character, there are three ways to go about it.
If you want to emit particles from just one character - and one character only, then you can do one of two things. Either set the 'DefaultParticleEmitPosition' value in ParticleSystem to the position of your character each update, or alternatively if you are using a toggle trigger particle system, set the DefaultParticleEmitPosition value in the trigger.

Finally, if you need particles to fire from multiple characters, and trail behind them, then you can really only manually trigger the particles per-frame. This would be using a standard particle trigger (and passing in the position each time you call 'FireTrigger'). This is how the 'bursts' effect happens in tut. 23. Note that this will likely require you set GPU buffering to true (also shown in tut 23).