Particle problem
by Kyle Goodwin · in Torque Game Engine · 11/02/2004 (10:32 am) · 33 replies
I'm trying to create a particle emitter which will emit particles such that they would seem to be drawn flat on the xy plane. I want to create a spell effect which uses a particle emitter positioned near the feet of a character to make a symbol appear to be encircling the character's legs, but I've played with the orientation stuff in the emitters and can't seem to get this functionality. Can this be done in script as is or must I hack the ParticleEmitter code?
About the author
#2
11/02/2004 (3:27 pm)
EDIT: Sorry, Double posted.
#3
11/02/2004 (3:29 pm)
It CAN be done in script as is.
#4
11/02/2004 (4:04 pm)
Any suggestions as to how to go about it Gonzo?
#5
Hope it helps some, not sure if it's what you wanted, just a quick test. It keeps the particles on the ground.
11/02/2004 (5:44 pm)
Maybe this will get you started :datablock ParticleData(RuneParticle) {
dragCoefficient = "0";
windCoefficient = "0";
gravityCoefficient = "0";
inheritedVelFactor = "0";
constantAcceleration = "0";
lifetimeMS = "876";
lifetimeVarianceMS = "296";
spinSpeed = "0.89";
spinRandomMin = "0";
spinRandomMax = "495";
useInvAlpha = "0";
animateTexture = "0";
framesPerSec = "1";
textureName = "./data/shapes/particles/spark3";
animTexName[0] = "./data/shapes/particles/spark3";
colors[0] = "0.0 0.0 1.0 1.0";
colors[1] = "1.0 1.0 1.0 1.0";
colors[2] = "0.0 0.0 1.0 0.8";
colors[3] = "0.000000 0.000000 0.600000 0.500000";
sizes[0] = "0.74";
sizes[1] = "0.49";
sizes[2] = "0.74";
sizes[3] = "1";
times[0] = "0";
times[1] = "0.8";
times[2] = "0.8";
times[3] = "1";
};
datablock ParticleEmitterData(RuneParticleEmitter) {
className = "ParticleEmitterData";
ejectionPeriodMS = "1";
periodVarianceMS = "0";
ejectionVelocity = "0";
velocityVariance = "0.5";
ejectionOffset = "1";
thetaMin = "90";
thetaMax = "90";
phiReferenceVel = "360";
phiVariance = "360";
overrideAdvance = "0";
orientParticles = "1";
orientOnVelocity = "1";
particles = "RuneParticle";
lifetimeMS = "3000";
lifetimeVarianceMS = "0";
useEmitterSizes = "0";
useEmitterColors = "0";
};
datablock ParticleEmitterNodeData(RuneParticleEmitterNode)
{
timeMultiple = 1;
};Hope it helps some, not sure if it's what you wanted, just a quick test. It keeps the particles on the ground.
#6
to
Not sure what texture you have, but it looks alright with the one i'm using :)
11/02/2004 (5:51 pm)
Actually, in the particle data change lifetimeMS = "876"; lifetimeVarianceMS = "296"
to
lifetimeMS = "500"; lifetimeVarianceMS = "20";
Not sure what texture you have, but it looks alright with the one i'm using :)
#7
11/02/2004 (6:05 pm)
That actually makes a ring in the xy plane of particles oriented perpendicular to the xy plane instead of a particle which is actually oriented *on* the xy plane, but it is a neat effect none-the-less and I think I have an idea for a cool way to use it, thanks.
#8
11/02/2004 (6:12 pm)
Are you talking torque coordinate system? It's my understanding that z points up, and y points forward.
#9
I think this would be a nice powering up effect for any character when they are recovering magic.
But the effect your looking for Kyle is one I have seen in many anime games and film. But like everything anime that technique is called something but I cant remember it.
Here is a nice tutorial I used to make that effect for stills :)
Glowing Tailsman
11/02/2004 (6:16 pm)
In a earlier realm war download that I had on my HD there is this Cylinder of Light that appears while your character is loading up.I think this would be a nice powering up effect for any character when they are recovering magic.
But the effect your looking for Kyle is one I have seen in many anime games and film. But like everything anime that technique is called something but I cant remember it.
Here is a nice tutorial I used to make that effect for stills :)
Glowing Tailsman
#10
11/02/2004 (6:22 pm)
Hey, my long lost bro. I'm not sure, but I think they use a .dts for the spawn effect.// fxEffects.cs
datablock StaticShapeData(GhostReviveEffect)
{
category = "Effects";
shapeFile = "~/data/shapes/effects/fx01/fx01.dts";
};
#11
11/02/2004 (6:25 pm)
Right, z points up and the xy plane is therefore parallel to flat ground. The code above makes a ring where particles "stand up" with their "feet" on the xy plane and face either all towards the center of the circle or outward depending on which way you consider particles to face.
#12
11/02/2004 (6:26 pm)
Yeah, I've considered using a dts for this and it could certainly be done, but I thought it would be much more easily extensible to use particles, not to mention the fact that logically the effects are particles rather than objects. If nothing else works out I'll probably go that route, though.
#13
@Kyle a completely 3D particle system maybe along the lines of the ability and flexibilty that Melv has done with T2D retro would be the ultimate solution.
But if you get a break-thru using particles that would be great. make those particles sing dance and do a little jig. :)
11/02/2004 (6:34 pm)
@James heh you never know :)@Kyle a completely 3D particle system maybe along the lines of the ability and flexibilty that Melv has done with T2D retro would be the ultimate solution.
But if you get a break-thru using particles that would be great. make those particles sing dance and do a little jig. :)
#14
EDIT: I started trying to tell you how to do what you wanted to do and realized it would just be easier and faster to make it for you than to type out all the steps and go through trouble shooting and such. Here's what it looks like from the clients POV...
It's a pulsating and oscilating smoke ring of shifting color that is augmented by a few sub particle effects you can expand on later...The total effect time is 5 seconds. Can be any time you choose.
In these next three shots you are looking at it from another players POV. Notice that the light that is under the circle expands from smaller to larger over the sequence. This light grows as the time expires to signify an intensity increase while charging your spell.
You can test these by using the command....
SpellTest(%client, Circle);
or
SpellTest(%client, Dome);
I added "Dome" and another surprise that's not in the pics. Make sure the two Bitmap pathways are correctly set or this wont work.
Now all you need is the code, which is below...
11/03/2004 (1:19 am)
What you need is a good old fashion explosion. An explosion does not have to do damage to anything just because it is an explosion. EDIT: I started trying to tell you how to do what you wanted to do and realized it would just be easier and faster to make it for you than to type out all the steps and go through trouble shooting and such. Here's what it looks like from the clients POV...
It's a pulsating and oscilating smoke ring of shifting color that is augmented by a few sub particle effects you can expand on later...The total effect time is 5 seconds. Can be any time you choose.
In these next three shots you are looking at it from another players POV. Notice that the light that is under the circle expands from smaller to larger over the sequence. This light grows as the time expires to signify an intensity increase while charging your spell.
You can test these by using the command....
SpellTest(%client, Circle);
or
SpellTest(%client, Dome);
I added "Dome" and another surprise that's not in the pics. Make sure the two Bitmap pathways are correctly set or this wont work.
Now all you need is the code, which is below...
#15
11/03/2004 (1:20 am)
Function SpellTest(%client, %type)
{
%pos = vectorAdd(%client.player.getPosition(), "0 0 0.4");
%p = new Explosion()
{
dataBlock = "GTC_SpellExplosion_" @ %type;
position = %pos;
client = %client;
};
MissionCleanup.add(%p);
}
datablock ParticleData(GTC_SpellParticle_Circle)
{
textureName = "Shared/Particles/smoke";
dragCoefficient = 0.0;
gravityCoefficient = -0.05;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 420.0;
lifetimeVarianceMS = 25.0;
spinRandomMin = -135.0;
spinRandomMax = 135.0;
colors[0] = "1.2 0.2 1.5 1.0";
colors[1] = "1.5 0.0 1.5 1.5";
colors[2] = "1.5 0.2 1.2 1.0";
colors[3] = "1.5 0.2 1.2 0.2";
sizes[0] = 0.2;
sizes[1] = 0.3;
sizes[2] = 0.4;
sizes[3] = 0.2;
times[0] = 0.0;
times[1] = 0.33;
times[2] = 0.66;
times[3] = 1.0;
};
datablock ParticleEmitterData(GTC_SpellEmitter_Circle)
{
ejectionPeriodMS = 2.0;
periodVarianceMS = 1.0;
ejectionVelocity = 0.0;
velocityVariance = 0.0;
ejectionOffset = 1.5;
thetaMin = 90.0;
thetaMax = 90.0;
phiReferenceVel = 0.0;
phiVariance = 360.0;
overrideAdvance = false;
orientParticles = false;
particles = GTC_SpellParticle_Circle;
};
datablock ParticleEmitterData(GTC_SpellEmitter_Dome)
{
ejectionPeriodMS = 1.0;
periodVarianceMS = 0.0;
ejectionVelocity = 0.0;
velocityVariance = 0.0;
ejectionOffset = 2.2;
thetaMin = 0.0;
thetaMax = 100.0;
phiReferenceVel = 0.0;
phiVariance = 360.0;
overrideAdvance = false;
orientParticles = false;
particles = GTC_SpellParticle_Circle;
};
datablock ParticleData(GTC_SpellParticle_Bubble)
{
textureName = "Shared/Particles/Bubble";
dragCoefficient = 0.1;
gravityCoefficient = -0.175;
windCoefficient = 0.0;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 1250;
lifetimeVarianceMS = 150;
spinRandomMin = -135.0;
spinRandomMax = 135.0;
useInvAlpha = false;
colors[0] = "0.9 0.2 0 0.4";
colors[1] = "0.9 0.2 0 0.8";
colors[2] = "0 0 0 0.2";
sizes[0] = 0.075;
sizes[1] = 0.15;
sizes[2] = 0.05;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(GTC_SpellEmitter_Bubble)
{
ejectionPeriodMS = 5.5554;
periodVarianceMS = 0;
ejectionVelocity = 0.0;
velocityVariance = 0.0;
ejectionOffset = 1.55;
thetaMin = 90.0;
thetaMax = 90.0;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = false;
lifeTime = 4500;
particles = GTC_SpellParticle_Bubble;
};
datablock ParticleEmitterData(GTC_SpellEmitter_Bubble2)
{
ejectionPeriodMS = 5.0;
periodVarianceMS = 1.1;
ejectionVelocity = 0.0;
velocityVariance = 0.0;
ejectionOffset = 1.45;
thetaMin = 90.0;
thetaMax = 90.0;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
orientParticles = false;
lifeTime = 4500;
particles = GTC_SpellParticle_Bubble;
};
datablock ExplosionData(GTC_SpellExplosion_Circle)
{
//soundProfile = GTC_SpellCircleSound;
lifeTimeMS = 5000;
emitter[0] = GTC_SpellEmitter_Bubble;
emitter[1] = GTC_SpellEmitter_Bubble2;
emitter[2] = GTC_SpellEmitter_Circle;
shakeCamera = false;
lightStartRadius = 1;
lightEndRadius = 5;
lightStartColor = "0.9 0.4 0.2";
lightEndColor = "0.9 0.9 0.3";
};
datablock ExplosionData(GTC_SpellExplosion_Dome)
{
//soundProfile = GTC_SpellCircleSound;
lifeTimeMS = 5000;
emitter[0] = GTC_SpellEmitter_Dome;
emitter[1] = GTC_SpellEmitter_Dome;
shakeCamera = false;
lightStartRadius = 3.5;
lightEndRadius = 0.5;
lightStartColor = "0.9 0.4 0.2";
lightEndColor = "0.9 0.9 0.3";
};
#16
11/03/2004 (5:26 am)
Thanks, that's really cool. I'll definitely make use of that effect, but it isn't really what I was initially asking about having an arbitrary shape (drawn in a particle mask) oriented on the xy-plane. Still, very cool note-the-less. (It's more ot less the same as the ring-like particle effect givem by the other code above, but the pulsating bit makes it cooler looking.) Also note that you can't really create explosions on the server since they won't actually show up on client machines in multiplayer without some trickery.
#17
When I get some time to do so, I'll see about a possible emitter mask setup.
11/03/2004 (2:36 pm)
Kyle, the scripted explosions have been fixed in the SDK in late August I believe. So they should show up on the network now. And I misread your initial post(late night, tired) and you said EN-circling the player, not circling, my bad. Now that I better understand what you were wanting I see now that Ben is correct, the emitter code needs to be played with. The emitter code could HUGELY benifit from having an offset variance instead of just a hard point to shoot from.When I get some time to do so, I'll see about a possible emitter mask setup.
#18
11/03/2004 (5:30 pm)
Thanks, I really appriciate the help and the cool effects I wasn't expecting, too! Good to hear that about the explosions being fixed.
#19
11/03/2004 (6:26 pm)
I added a new field in the ParticleEmitterData for orientOnXYPlane and changed the code a bit...now it works like a charm, I shoulda just done that originally. ;) I'll post some screenies when I have my particle are done in a little bit (gonna try out that above tutorial for making such things).
#20
orientParticles = false;
to...
orientParticles = true;
And they will render flat I believe, not sure if that's what you were loking for or if you had tried it.
I look forward to your screen shots
11/03/2004 (7:43 pm)
If you are saying that you want the particle to be flat instead of them being rendered on a flat plane, then you could just changeorientParticles = false;
to...
orientParticles = true;
And they will render flat I believe, not sure if that's what you were loking for or if you had tried it.
I look forward to your screen shots
Associate Kyle Carter