Script-born particles
by Samuel Marcus · in Torque Game Builder · 11/14/2006 (1:30 am) · 5 replies
I'm trying to create an effect without using the editor, but my test-case crashes Torque. It looks like an infinite loop and I suspect it has to do with graph-fields being undefined. When you create a new particle effect/emitter, are its graph-fields given defaults or need all of them be defined by hand (even things like spin or what-have-you which I may not even be using)?
Alternatively: does someone have a "naked" particle effect scripted somewhere that I could see as a sort of template?
thanks!
Alternatively: does someone have a "naked" particle effect scripted somewhere that I could see as a sort of template?
thanks!
About the author
#2
11/15/2006 (11:32 am)
So are there any obvious reasons why adding one might cause the game to crash Torque on loading?
#3
When I uncomment the last line, it crashes. (the game creates this class and then calls MakeItRain)
11/15/2006 (11:34 am)
Here's what I have:datablock t2dImageMapDataBlock(rain)
{
imageName = "~/data/images/rain.png";
imageMode = key;
size = "32 216";
frames = 4;
};
function rainGod::makeItRain(%this, %scenegraph)
{
%rainStorm = new t2dParticleEffect()
{
layer = 3;
sceneGraph = %sceneGraph;
};
%droplet = new t2dParticleEmitter();
%droplet.setImageMap(rain, 0);
%droplet.setEmitterType(LINEX);
%droplet.setAttachPositionToEmitter(false);
%droplet.setFixedAngleOffset(0);
%rainStorm.addEmitter(%droplet);
%rainStorm.setEffectLifeMode(KILL, 5);
// %rainStorm.playEffect();
}When I uncomment the last line, it crashes. (the game creates this class and then calls MakeItRain)
#4
11/15/2006 (1:31 pm)
Resolved! addEmitter() doesn't do what I thought it did.
#5
change:
remove
02/23/2012 (10:56 pm)
Well, 5 years later, but here's how to fix it:change:
// %droplet = new t2dParticleEmitter(); %droplet = %rainStorm.addEmitter();
remove
%rainStorm.addEmitter(%droplet);
Torque 3D Owner Matthew Langley
Torque