Game Development Community

Explosion Node

by Morrock · in Torque Game Engine · 07/22/2008 (6:43 pm) · 6 replies

Anybody out there know if there is some sort of ExplosionNode object which I can use to generate an explosion, just like you would create a particle effect with a ParticleEmitterNode? Or some other way to achieve the same effect? Or will I just have to cheat and do something like creating a projectile an inch from the surface of the explosion. This would have to be in script by the way.

Any help is appreciated.

#1
07/22/2008 (6:50 pm)
Huh? Why not just use a particle emitter for the explosion?
#2
07/22/2008 (7:01 pm)
Can you use a particleEmitter for a full explosion, with debris, subExplosion's etc...?
#3
07/22/2008 (8:57 pm)
You could with more than one particle emitter. Also if you are interested in purchasing AFX you can do some really cool stuff with it.
#4
07/23/2008 (6:12 am)
What James said, (cos really it'll be best imo) or...

There is actually a class within Torque that is called Explosion (original idea eh?) that is utilised by projectile to do the type of explosion you are after. Its not really hooked up to script by the looks of it though.
#5
07/23/2008 (6:25 am)
Thanks for the idea James, I never even thought of it before, but I could just use seperate ParticleEmitterNode's all in the same position which could use the explosion's emitter[]'s as the datablocks. I know how cool AFX is, but it wouldn't help with this project at all; thanks though :-)

Craig, yes that's exactly what I was going for, trying to see if I was able to call some kind of ExplosionNode or something, using the ExplosionData as a datablock just like you are able set up ParticleEmitterNode's with ParticleEmitters in script.
#6
07/30/2008 (12:25 pm)
Turns out you can add explosions easily via script, just create on and add it to the mission. It will call it's explode() function once it is added, and then you can just schedule a delete() to get rid of it. For example, here is the code used by my Particle Editor

%explosion = new Explosion()
	{
		position = "100 100 105";
		datablock = PEx_ExplosionSelector.getText();
		rotation = "1 0 0 0";
		scale = "1 1 1";
	};
	EditorGroup.add(%explosion);
	%time = PEx_ExplosionSelector.getText().lifetimeMS;
	%explosion.schedule(%time, delete);
Where "100 100 105" is the location the explosion is to explode at (you can use a variable, of course) and PEx_ExplosionSelector is a selector for the current explosion Datablock. getText returns the datablock name.