ParticleEmitterNodeData = only 2 needed?
by Steve Acaster · in Torque 3D Professional · 01/18/2010 (12:29 am) · 1 replies
Whilst messing around with particles in 1.0.1, I noticed that the datablock for the actual emitter nodes only seems to carry a single variable; TimeMultiple=bool, and no reference to actual particle or emitter datablocks (which is all handled in ParticleEmitter object).
Would I thus be correct in thinking that there would thus only be need for two instances of ParticleEmitterNodeData (1 and 0) and no requirement for a ParticleEmitterNodeData for every single Emitter type? (thus also saving shed loads of space in unneccessary datablocks)
I've tried this and it appears that itworks fine.
However I'm not certain what the difference between TimeMultiple = 0/1 is ... Though using zero appears to not start the emitter at all.
Would I thus be correct in thinking that there would thus only be need for two instances of ParticleEmitterNodeData (1 and 0) and no requirement for a ParticleEmitterNodeData for every single Emitter type? (thus also saving shed loads of space in unneccessary datablocks)
datablock ParticleEmitterNodeData(TimeMultiple1Node)
{
timeMultiple = 1;
};
datablock ParticleEmitterNodeData(TimeMultiple0Node)
{
timeMultiple = 0;
};
//===========================================================
//and the function to spawn the emitter object
function stalker1data::PlayStalkerBlast(%this, %obj)
{
//stalker attack particle effect
%stalkparticle = new ParticleEmitterNode()
{
position = %obj.getposition();
rotation = "1 0 0 0";
scale = "1 1 1";
//dataBlock = "StalkerSparkEmitterNode";
dataBlock = "TimeMultiple1Node";
emitter = "StalkerSparkEmitter";
velocity = "1";
};
%stalkparticle.schedule(1500,"delete");
}
//dataBlock = "StalkerSparkEmitterNode";
//is redundant with just using TimeMultiple0Node and TimeMultiple1NodeI've tried this and it appears that itworks fine.
However I'm not certain what the difference between TimeMultiple = 0/1 is ... Though using zero appears to not start the emitter at all.
About the author
One Bloke ... In His Bedroom ... Making Indie Games ...
Associate Steve Acaster
[YorkshireRifles.com]
Whilst it complains that it wants a variable between 0.01 and 100.00, it will accept a straight zero with just a console warning, thus effectively becoming an on/off trigger for emitters ('cos I couldn't work out another way off doing it).
So, sticking with the idea of just having 2 ParticleEmitterNodeData and using it as a 0/1 bool, I can trigger the emitters' state on the fly, with no need for further instances of ParticelEmitterNodeData.
//emitter is named particletest1 in World Editor //using a trigger to check/alter the emitter's state %active=particletest1.getdatablock().getname(); if(%active $="timemultiple0node") { particletest1.setdatablock(TimeMultiple1Node); echo("Start Emitter ParticleTest1!"); } else { particletest1.setdatablock(TimeMultiple0Node); echo("Stop Emitter ParticleTest1"); }That seems to work as I want it to, and I don't currently foresee requiring more than this bool of 2 NodeDatas (for myself, anyhow).