Using ParticleEmitterNode as an explosion.
by Derrick Austin · in Technical Issues · 02/02/2009 (5:47 pm) · 3 replies
I'm trying to use a ParticleEmitterNode as an explosion since Explosion does not show up on the client side. Unfortunately, I can not get the EmitterNode to disappear so I end up with a bunch of blue blobs floating around my maps... :(
Here is the code I am using... Any ideas?
Here is the code I am using... Any ideas?
Quote:
//-----------------------------------------------------------------------------
// Spell bolt projectile particles
datablock ParticleData(PotionExplosionParticle){
textureName = "~/data/shapes/particles/smoke";
dragCoefficient = 2;
gravityCoefficient = 0.2;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 1000;
lifetimeVarianceMS = 150;
colors[0] = "0.002362 0.010866 0.700000 0.370079";
colors[1] = "0.000000 0.102362 0.800000 0.740157";
sizes[0] = 0.5;
sizes[1] = 1.0;
};
datablock ParticleEmitterData(PotionExplosionEmitter){
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 2;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 60;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
particles = "PotionExplosionParticle";
};
datablock ParticleEmitterNodeData(PotionSource){
timeMultiple = 1;
};
Quote:
%p = new ParticleEmitterNode(){
position = %finalPos;
rotation = "1 0 0 0";
scale = "1 1 1 1";
dataBlock = PotionSource;
emitter = PotionExplosionEmitter;
velocity = 1;
client = %user.client;
};
MissionCleanup.add(%p);
About the author
#2
I seem to remember that from a while back. Maybe it got fixed ... maybe not.
If you do have problems create a delete function and have the create function schedule that.
I might be wrong, I might be thinking of datablock functions deleting themselves.
02/02/2009 (8:34 pm)
Doesn't having something (ie: a function) schedule it's own delete cause problems? I seem to remember that from a while back. Maybe it got fixed ... maybe not.
If you do have problems create a delete function and have the create function schedule that.
//psuedo-code
function create_explosion(%this, %that, %theother)
{
//your stuff here
MissionCleanup.add(%p);
%this.scehdule(1000, "delete_explosion");
}
//------------------------------------
function delete_explosion(%p)
{
%p.schedule(2000,"delete");
}
//end of psuedocodeI might be wrong, I might be thinking of datablock functions deleting themselves.
#3
02/02/2009 (8:39 pm)
I haven't experienced any issues - but if I do - I will certainly try the code ups ^
Derrick Austin