Game Development Community

Complete Particle Definitions

by Jeff Trier · in Torque Game Engine · 05/10/2003 (7:42 am) · 10 replies

I have been looking around on various sites to find not only a complete list of particle functions(which I have found), but a description of what each function does. Does anyone have a link or document that I could have regarding this?


Thanks,
-Jeff

About the author

Originally a Classical/Metal musician, I've always been attracted to anything involving computers, including: Networking, PC Building and Repair, software design and coding. I've been involved with game design and development for over 10 years.


#1
05/10/2003 (8:15 am)
[ParticleData]
dragCoefficient = 0.0; //The amount of initial velocity to be substracted from the velocity per second.

gravityCoefficient = 0; //The amount of gravity acceleration to be aplied on the particle.

inheritedVelFactor = 1.0; //The amount of velocity to be ported over from the emitter object to the particle.

constantAcceleration = 0; //The amount of the initial velocity to be added to the velocity per second.

lifetimeMS = 620; //The time in ms each particle has before it dissapates.

lifetimeVarianceMS = 50; //This will make lifetimeMS an value between 620+lifetimeVarianceMS and 620-lifetimeVarianceMS;

spinRandomMin = 0.0; //The minium angle/second an particle spins if it's not oriented.

spinRandomMax = 0.0; //The maximum angle/second an particle spins if it's not oriented.

windCoefficient = 0; //The amount of wind acceleration is added to the particle's velocity.

useInvAlpha = false; //This inverses the colors of the texture used by the particle.

textureName = "~/data/shapes/rifle/smokeParticle"; //The .png texture to be used by the particle.

//Each particle has 4 key frames.
//times[i] tells the particle when the key frame happens.
//Time[2] = 0.5; would make the third key frame start at 1/2 the particles live time.
//At each key frame the particle has it's collor and size exactly like the keyframe values tell it to, inbetween keyframes the collor and size gradually change to match.
times[0] = 0.0;
times[1] = 0.13;
times[2] = 0.5;
times[3] = 1.0;
colors[0] = "0.3 0.3 0.9 1";
colors[1] = "0.3 0.3 0.9 1";
colors[2] = "0.2 0.2 0.8 1";
colors[3] = "0.5 0.5 0.5 1.0";
sizes[0] = 0.05;
sizes[1] = 0.65;
sizes[2] = 0.35;
sizes[3] = 0.20;



[ParticleEmitterData]

//Each particle gets emitted in an certain direction.
//While the global direction depend on certain settings,
//it's easy to think of the maximum being spherical.. or.. all directions.
//An emitter using it's full direction potential will have particles starting with velocities in all directions and offsets wich are in the same direction.

ejectionPeriodMS = 50; //The amount of time between particle emissions.

periodVarianceMS = 0; //The variance of ejectionPeriodMs.

ejectionVelocity = 0; //Each particle will start out with this amount of velocity in the direction of it's emission.

velocityVariance = 0; //The variance of this velocity.

ejectionOffset = 1; //Each particle will start this amout of meters away from the emitter in the direction of it's emission.

//Theta and phi are bassically the angles determining the initial direction of the particle.
//Assume your a torque player, and you emitt particles in the direction your looking.
//Theta would be you looking up or down with 0 being totally up and 180 being totally down.
//Phi would be you looking more left or right.. with 0 being forward, 180 would make you turn to face backward.. and 360 would make you face forward again.
//The combination of those two will allow you to create certain emittion paterns.. like spheres and circles.

thetaMin = 0; //The minium theta angle to emitter particles at.

thetaMax = 90;//The maximum theta angle to emitter particles at.

phiVariance = 0; //The maximum phi angle to use (minimun would be 0)
//90 would be front to right
//180 would be front to right to backward.
//270 would be front to right to backward to left.
//360 would be a full circle and thus all directions.

phiReferenceVel = 0; //This value makes your emitter turn it's '0' phi around in time.
//Looking back at the player example: slowly making you look to the right.

overrideAdvances = False; //Not sure.

particles = "PlayerJetP1"; //The particle datablock to use for emission.

orientParticles = True; //This will make the particles face their emission direction instead of the player.

orientOnVelocity = False; //This along with orientParticles being true will make particles face the direction they are flying to (including gravity/wind).


---------------------------------------------------------------
Ok.. that should be all.
if any isn't totally clear.. just ask.. tho it's always best to just try them ingame and see what they actually do.
#2
05/10/2003 (8:21 am)
Wow, thanks Sebastiaan!

That's great!

-Jeff
#3
05/10/2003 (8:22 am)
As a usage example, here's a previous members post.

(Jared Schnelle)

...
This is a copy of the code I use to create storm clouds when I have a hail storm.


This section is the block of code which actually creates an instance of the emitter in your game.
Note: the schedule(5000, ....), this function will schedule something to happen X number of milliseconds down the road. So 5 seconds after the cloud is created, I have it deleted.



function CreateHailCloud(%pos)
{
%cloudEmitterName = new ParticleEmitterNode(Cloud)
{
position = %pos;
rotation = "0 0 0 0";
scale = "1 1 1";
dataBlock = "CloudEmitterNode";
emitter = "CloudEmitter";
velocity = "1";
};
schedule(5000, 0, "EmitterDelete", %cloudEmitterName);
MissionCleanup.add(%cloudEmitterName);
return %cloudEmitterName;
}

function EmitterDelete(%name)
{
%name.delete();
}

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


This code defines what a "CloudParticle" is.


datablock ParticleData(CloudParticle)
{
dragCoefficient = 0;
gravityCoefficient = 0.461538;
windCoefficient = 0;
inheritedVelFactor = 0;
constantAcceleration = 0;
lifetimeMS = 1152;
lifetimeVarianceMS = 128;
useInvAlpha = 1;
spinRandomMin = -30;
spinRandomMax = 30;
textureName = "fps/data/shapes/particles/grayCloud.png";
spinSpeed = 114.706;
times[0] = 0;
times[1] = 0.101961;
times[2] = 1;
colors[0] = "1.000000 1.000000 1.000000 0.070866";
colors[1] = "1.000000 1.000000 1.000000 0.291339";
colors[2] = "0.102362 0.086614 0.102362 0.000000";
sizes[0] = 2.05701;
sizes[1] = 3.50668;
sizes[2] = 5.16084;
};


And this code defines how those cloud particles are spit out of the emitter which you create in the game.


datablock ParticleEmitterData(CloudEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 5;
ejectionVelocity = 1.57;
velocityVariance = 1.87;
ejectionOffset = 1.87;
thetaMin = 90;
thetaMax = 90;
phiReferenceVel = 360;
phiVariance = 360;
overrideAdvances = 0;
orientParticles= 0;
orientOnVelocity = 1;
particles = "CloudParticle";
};


-Jared
#4
05/10/2003 (8:25 am)
Great example Dee. :)

Thanks again guys, you rock!

EDIT:
I can't seem to get my 256x64 sprite to maintain it's proportion when it's emitting. It seems to squeeze the sprite into a square dimention. Is there a way to adjust this?

Thanks,
-Jeff
#5
05/10/2003 (10:54 am)
Follow this link
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4096

It has the feature your asking for... along with a shitload of new options..
#6
05/10/2003 (1:05 pm)
Thanks again :)

-Jeff
#7
05/11/2003 (6:06 pm)
This is kind of off topic, but this thread reminded me of something. I've been thinking for a while that it would probably be helpful to a lot of people if there was somewhere people could submit cool particle effects they have put together. Kind of like the code snippets section, but for this specific script type. I'm sure there's a lot of art to it.
#8
04/13/2004 (11:02 pm)
Thank you for this information.
It is very useful for me.

-Fredrik
#9
12/11/2005 (5:22 pm)
Any one know how to make a particle emitter orient the particles to always face the camera?
#10
12/11/2005 (7:59 pm)
Todd,
orientParticles = True; //This will make the particles face their emission direction instead of the player.

I think if you set it to false you will get what you want.