Trying to Add a Basic Particle
by TheHidden · in Torque Developer Network · 04/03/2010 (5:36 pm) · 1 replies
I am trying to follow the directions on http://www.davidjsushil.com/index.php?action=tutorials on adding basic particles. To try it out for my lab that is due tomorrow night, and no one has yet responded to me in class about what the image should be, I first tried just a black line. Then I went to grab some particle1.png off the web that has some circles or something. I can not even draw stick figures and without knowing what this document wants, I tried using both, but at the moment, the problem is not image related.
Using the document, I copied the code and now I have particle1.png and particle1.cs. I changed the name in the code from "steam_puff" to "particle1" and anything else as "steam" or (assuming all this has to stay case sensitive) "Steam" to "particle1" and "Particle1" respectively.
In game.cs I added:
exec("demo/data/shapes/dapparticles/particle1.cs");
particle1.png and particle1.cs are in:
TorqueTGE_1_5_2exampledemodatashapesdapparticles
The cs file is:
datablock ParticleData(particles1){
textureName = "~/data/shapes/dapparticles/particles1.png";
lifetimeMS = 300;
lifetimeVaranceMS = 100;
colors[0] = "0.5 0.5 0.5 0.75";
colors[1] = "0.4 0.4 0.45 0.5";
colors[2] = "0.3 0.3 0.4 0.125";
colors[3] = "0.2 0.2 0.35 0";
sizes[0] = 1.0;
sizes[1] = 1.1;
sizes[2] = 1.5;
sizes[3] = 2;
times[0] = 0.0;
times[1] = 0.3;
times[2] = 0.6;
times[3] = 1;
spinSpeed = 0;
spinRandomMin = -100;
spinRandomMax = 100;
gravityCoefficient = -10;
constantAcceleration = 5;
dragCoefficient = 2;
};
datablock ParticleEmitterData(particles1_column){
particles = particles1;
ejectionPeriodMS = 25;
periodVarianceMS = 2;
ejectionVelocity = 5;
velocityVariance = 2;
thetaMax = 10;
thetaMin = 0;
phiReferenceVal = 0;
phiVariance = 10;
lifeTimeMS = 0;
};
datablock ParticleEmitterNodeData(particles1_source){
timeMultiple = 1;
};
function addParticles1(){
%particles1Obj = new ParticleEmitterNode(){
position = "238 -205.75 191";
rotation = "1 0 0 0";
scale = "1 1 1 1";
dataBlock = particles1_source;
emitter = particles1_column;
velocity = 1;
};
}
(All code just copied and I changed file names.)
Now, when I type in the program "addParticles1();", it tells me it can not find the function. I have been at this for days without change or support from my professor or class. Only got a day left and still other parts of the lab to do still. Guess I should have come here first earlier this week.
Any ideas from you gurus on what I missed?
Thanks.
TGE 1.5 (registered).
Using the document, I copied the code and now I have particle1.png and particle1.cs. I changed the name in the code from "steam_puff" to "particle1" and anything else as "steam" or (assuming all this has to stay case sensitive) "Steam" to "particle1" and "Particle1" respectively.
In game.cs I added:
exec("demo/data/shapes/dapparticles/particle1.cs");
particle1.png and particle1.cs are in:
TorqueTGE_1_5_2exampledemodatashapesdapparticles
The cs file is:
datablock ParticleData(particles1){
textureName = "~/data/shapes/dapparticles/particles1.png";
lifetimeMS = 300;
lifetimeVaranceMS = 100;
colors[0] = "0.5 0.5 0.5 0.75";
colors[1] = "0.4 0.4 0.45 0.5";
colors[2] = "0.3 0.3 0.4 0.125";
colors[3] = "0.2 0.2 0.35 0";
sizes[0] = 1.0;
sizes[1] = 1.1;
sizes[2] = 1.5;
sizes[3] = 2;
times[0] = 0.0;
times[1] = 0.3;
times[2] = 0.6;
times[3] = 1;
spinSpeed = 0;
spinRandomMin = -100;
spinRandomMax = 100;
gravityCoefficient = -10;
constantAcceleration = 5;
dragCoefficient = 2;
};
datablock ParticleEmitterData(particles1_column){
particles = particles1;
ejectionPeriodMS = 25;
periodVarianceMS = 2;
ejectionVelocity = 5;
velocityVariance = 2;
thetaMax = 10;
thetaMin = 0;
phiReferenceVal = 0;
phiVariance = 10;
lifeTimeMS = 0;
};
datablock ParticleEmitterNodeData(particles1_source){
timeMultiple = 1;
};
function addParticles1(){
%particles1Obj = new ParticleEmitterNode(){
position = "238 -205.75 191";
rotation = "1 0 0 0";
scale = "1 1 1 1";
dataBlock = particles1_source;
emitter = particles1_column;
velocity = 1;
};
}
(All code just copied and I changed file names.)
Now, when I type in the program "addParticles1();", it tells me it can not find the function. I have been at this for days without change or support from my professor or class. Only got a day left and still other parts of the lab to do still. Guess I should have come here first earlier this week.
Any ideas from you gurus on what I missed?
Thanks.
TGE 1.5 (registered).
About the author
This account has not been used since 2010, but no way to delete it. :/
Torque 3D Owner RealmX