[null, {"document_url": "https://forums.torque3d.org/viewtopic.php?f=12&t=1003&sid=b1fe0cdbeb20494336f1384c4e940a4b&view=print", "unformatted_src": "http://i.imgur.com/bLrQcq7.jpg", "src": "http://i.imgur.com/bLrQcq7.jpg", "formatted_filename": "bLrQcq", "alt_text": "Image"}, null, {"document_url": "https://forums.torque3d.org/viewtopic.php?f=12&t=1003&sid=b1fe0cdbeb20494336f1384c4e940a4b&view=print", "unformatted_src": "http://i.imgur.com/GSXgOG5.jpg", "src": "http://i.imgur.com/GSXgOG5.jpg", "formatted_filename": "GSXgOG", "alt_text": "Image"}, null, null, {"document_url": "https://forums.torque3d.org/viewtopic.php?f=12&t=1003&sid=b1fe0cdbeb20494336f1384c4e940a4b&view=print", "unformatted_src": "http://i.imgur.com/1Z6PPJA.jpg", "src": "http://i.imgur.com/1Z6PPJA.jpg", "formatted_filename": "Z PPJA", "alt_text": "Image"}, null, null, {"document_url": "https://forums.torque3d.org/viewtopic.php?f=12&t=1003&sid=b1fe0cdbeb20494336f1384c4e940a4b&view=print", "unformatted_src": "http://i.imgur.com/sLKrmPQ.jpg", "src": "http://i.imgur.com/sLKrmPQ.jpg", "formatted_filename": "sLKrmPQ", "alt_text": "Image"}, null, null]
Forums | Torque 3D

The forums for the Torque 3D game engine

Particle Emitter Confusion




by Steve_Yorkshire
I've got a little confused with particleEmitters - especially the usefulness of phiVariance and phiReferenceVel.

What I want is to create a ring on the vertical, but only seem to be able to do this on the horizontal.

Here is what I've got. A ring on the horizontal when creating an emitter with ThetaMin/Max set to 90. When spawning it via an explosion it aligns to the impact vector (as expected). What I want is the opposite, so that the emitter particle is a vertical ring (and thus a horizontal ring when it hits a vertical surface in an 90 degree angled explosion).

Setting thetaMin/Max to 0-180 gives a full sphere, and there seems no way to "flatten" it or limit vertical angle of discharge.

I did some playing around with phiVariance (aka DEPTH in the particle Editor) and phiReferenceVel (which is not in the particle Editor but is an emitter value but god knows what it does) but that just cuts off some of the particle spawning. So setting depth/phiVariance to 180 gives half a circle on one side. Phi not terribly helpful here ...

So, any thoughts, insights or ideas would be appreciated. I'm thinking I might have to add a new value in particleEmitter.cpp/h to limit the thetaMin/Max over X (Y? Z?) ejection.

Here's my particle data if anyone is interested.

Re: Particle Emitter Confusion

by Duion
Rotate the particle effect, for example the default grenade explosion does a ring and when it explodes on a wall the ring is vertical, but may be just a stupid workaround.


So I added a flag in ParticleEmitterData to check for rotation around the Y(?) axis and then use that for aligning the normal at (0, 1, 0) on the ParticleEmitterNodeData.
Fine for particleEmitters ... except it turns out explosionData particles don't use the ParticleEmitterNodeData object ... (fuuuu-).

 Duion Exact same problem. Stock grenade explodes when it stops and is thus pointing upwards, so the smoke ring is ALWAYS horizontal to Z. So using it as a normal impact projectile gives the vertical orientated explosion against a vertical surface.


Okay, after much sniffing up the wrong tree I eventually got what I wanted.

Initially I managed to make particleEmitterNode rotate on the Z axis.

So then it turns out explosionData particles do not use particleEmitterNodes --- and I didn't have much success rotating the axis of the emitter for ejecting particles in ParticleEmitter.cpp.

So I had to make my changes inside explosion.cpp itself, with a reference to particleEmitterData to check whether the spawned particle should be flat (eg: face upwards).

First up, the flag to check for flat particles the emitter.

In particleEmitter.h In particleEmitter.cpp And the particleEmitter datablock in Torquescript: And finally in explosion.cpp:

And hey-presto it works. Currently the F32 RotateY is only acting as a bool, and this could be expanded to merge the math of the original mInitialNormal to give a true relative position, or a cut-off angle could be used: eg; if mInitialNormal.z < RotateY (say 0.8) use RotateY instead, etc, etc. 
Okay, found a problem.

All the particles in the explosion get the modification passed to them because mInitiialNormal gets reset. So here's the fix. Leave Britney/mInitialNormal Alone!!!! Behold 2 emitters, 1 using RotateY and the other without! 
by JeffR
Very slick