Game Development Community

Beginners particle question

by David Horn · in Torque Game Engine · 03/17/2008 (1:02 pm) · 2 replies

Hi,
I am somewhat of a beginner when it comes to particles. I have created several particle systems successfully but now i need a little guidance.

For the fighting game I'm creating, I want to have sweat/blood spray off the head of an opponent when I hit him. I have it working except for the emitter properties. Right now, it looks more like a fountain than a spray or a burst.

here is my code:

datablock ParticleData(HitParticle)
{
   textureName          = "~/data/shapes/particles/smoke";
   dragCoefficient      = 0;
   gravityCoefficient   = 1.0;
   windCoefficient      = 0;
   inheritedVelFactor   = 0.5;
   constantAcceleration = 0.0;
   lifetimeMS           = 400;
   lifetimeVarianceMS   = 100;
   spinRandomMin = -90.0;
   spinRandomMax =  90.0;
   useInvAlpha   = false;

   colors[0]     = "0.1 0.1 0.1 1.0";
   colors[1]     = "0.1 0.1 0.1 1.0";
   colors[2]     = "0.1 0.1 0.1 0";

   sizes[0]      = 0.02;
   sizes[1]      = 0.1;
   sizes[2]      = 0.01;

   times[0]      = 0.0;
   times[1]      = 0.5;
   times[2]      = 1.0;
};

datablock ParticleEmitterData(HitEmitter)
{
   ejectionPeriodMS = 0.1;
   periodVarianceMS = 0;
   ejectionVelocity = 1.0;
   velocityVariance = 0.25;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvances = false;
   orientParticles  = false;
   lifetimeMS       = 200;

   particles = "HitParticle";
};

datablock ParticleEmitterNodeData(HitNode)
{
   timeMultiple = 1;
};

Then I call it when the person gets hit...

new ParticleEmitterNode(hitparts) {
                  canSaveDynamicFields = "1";
                  position = %lx SPC %ly SPC %lz SPC %rx SPC %ry SPC %rz SPC %rd;
                  rotation = "1 0 0 0";
                  scale = "1 1 1";
                  dataBlock = "HitNode";
                  emitter = "HitEmitter";
                  velocity = "1";
               };

the position comes from a function that get's the fighter's head. That works fine, so just ignore that.

What I want to have happen is for maybe 20-25 particles to be launched simultaniously.
The only thing I could find is particleDensity which is a property of the Explosion - and an explosion is kind of what i need to change the "constany flowing" style to a more "bursting"

But it looks like the Explosion is specific for projectiles.
Is this something that needs to be addressed in code or could someone guide me with the script?

Thanks so much...

#1
03/23/2008 (1:45 am)
Unless I read this wrong...

datablock ParticleEmitterNodeData(HitNode)
{
   timeMultiple = 25;
};

That should set it to 25 particles rather than 1. If I understood your question correctly.
#2
03/27/2008 (6:11 am)
I actually was able to get what I need by modifying the "explosion"

but that timeMultiple is very good to know. Thank you.