Destructible items w/ explosions
by Stephen Clark · in Torque Game Engine · 01/27/2004 (10:43 am) · 15 replies
Is there a tutorial anywhere on how to make destructible items w/ explosions? I've seen the neat barrel from stefan, but i dont think ive ever seen any scripts?
Thanks,
-s
Thanks,
-s
#2
01/27/2004 (2:21 pm)
I thought I looked on beffy's awesome site before, but all i found were binaries for the barrel guy. I looked again and still couldnt find any?? Am i missing an area? The only thing I found were the FX content packs to buy?...
#4
01/27/2004 (11:29 pm)
Exactly, the first FX pack contains all the scripts, shapes, etc. you need for explosions... do we *have* to give everything away for free? :P
#5
-s
01/28/2004 (1:30 pm)
Haha... no you shouldnt! I'm suprised more ppl dont charge something for thier fx stuff.. I am just suprised that there arent any resources here on garagegames for something like this... I mean, its pretty basic, no? -s
#6
08/25/2004 (8:55 am)
Link to online store no worky :(
#7
www.3d-diggers.de/webshop/default.php?language=en
Although it would have been possible for you to get there from the homepage ;)
08/25/2004 (9:08 am)
Here it is: www.3d-diggers.de/webshop/default.php?language=en
Although it would have been possible for you to get there from the homepage ;)
#8
08/25/2004 (2:47 pm)
...small, clear, 150w bulb illuminates the top of Rex's greying hair...hmmm....all game objects based on same base class, health/energy, LOScol, damage, disabled, explosion, sound mix well....yes, I do believe I'm catching on...
#9
I've been working on destructibles for my project. I dont really have the money to buy the scripts so I've been just workin on it on my own... I have a problem however that I posted about in another thread... perhaps one of you guys could help me out... please dont take this as spam... I'm just trying to get help... here is the link:
www.garagegames.com/mg/forums/result.thread.php?qt=9966
Thank you,
Ryan Champ
11/05/2004 (12:57 pm)
Hello, I've been working on destructibles for my project. I dont really have the money to buy the scripts so I've been just workin on it on my own... I have a problem however that I posted about in another thread... perhaps one of you guys could help me out... please dont take this as spam... I'm just trying to get help... here is the link:
www.garagegames.com/mg/forums/result.thread.php?qt=9966
Thank you,
Ryan Champ
#10
I notice that in the source code, staticbase.cc, the damage thread covers frames 0 - 1. Is it as simple as this?
Thanks,
11/28/2004 (1:32 pm)
Not sure if this thread is dead or not, but does anyone have a tutorial on this topic? I'm specifically looking for how I can create 'sequence Damage' threads for models. I notice that in the source code, staticbase.cc, the damage thread covers frames 0 - 1. Is it as simple as this?
Thanks,
#11
1) I first created a simple model, and created a sequence and named it as 'sequence_Damage':
-starting frame = 0
-ending frame = 1
-Enable vis = on
-Cyclic = off
-all others = default
name of my detail2 is called 'glass' and have created two models:
-glassA2 = full model
- visibility: frame 0 = on, frame 1 = off
-glassB2 = damaged model
- visibility: frame 0 = off, frame 1 = on
-note-
I'm convince there could be other models at various fractional frame rates, e.g. at 0.25, 0.5, 0.75, etc. For simplisity sake, I've chosen to create only frames 0 and 1.
2) I export the file as 'glass.dts'. I mention this because of the script to follow.
3) create glassTube.cs script file.
** descrption **
When you fire at the glass, damage of 1 will cause model's damage sequence to trigger and display the glassB2 model.
-note-
This script can be extended and would be very cool if you can add shattered glass debris.
11/28/2004 (5:25 pm)
I have a destructable model working. I'll describe what I've done and hopefully others can benefit fromt this.1) I first created a simple model, and created a sequence and named it as 'sequence_Damage':
-starting frame = 0
-ending frame = 1
-Enable vis = on
-Cyclic = off
-all others = default
name of my detail2 is called 'glass' and have created two models:
-glassA2 = full model
- visibility: frame 0 = on, frame 1 = off
-glassB2 = damaged model
- visibility: frame 0 = off, frame 1 = on
-note-
I'm convince there could be other models at various fractional frame rates, e.g. at 0.25, 0.5, 0.75, etc. For simplisity sake, I've chosen to create only frames 0 and 1.
2) I export the file as 'glass.dts'. I mention this because of the script to follow.
3) create glassTube.cs script file.
function StaticShapeData::create(%block)
{
// The mission editor invokes this method when it
// wants to create an object of the given datablock
// type. You only need one of these methods for any
// class/datablock type (in this case StaticShape).
%obj = new StaticShape()
{
dataBlock = %block;
};
return(%obj);
}
//
datablock StaticShapeData(GlassTube)
{
category = "DamageItems";
shapeFile = "~/data/shapes/items/glass.dts";
maxDamage = 1;
destroyedLevel = 1;
};
function GlassTube::create(%block)
{
%obj = new StaticShape()
{
dataBlock = %block;
};
return(%obj);
}
function GlassTube::onCollision(%this,%obj,%collider)
{
}
function GlassTube::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
echo("GlassTube::damage() obj=" @ %obj @ ", source=" @ %sourceObject @ ", damage=" @ %damage);
%obj.applyDamage("1");
}
function GlassTube::onDamage(%this, %obj, %delta)
{
echo("GlassTube::onDamage() obj=" @ %obj @ ",delta=" @ %delta);
}** descrption **
When you fire at the glass, damage of 1 will cause model's damage sequence to trigger and display the glassB2 model.
-note-
This script can be extended and would be very cool if you can add shattered glass debris.
#12
11/29/2004 (10:03 pm)
You can add debris. you just need to make the dts models that represent the shards. You put the proper prameters in the main objects datablock and then create a debris datablock for the flying glass shards..datablock StaticShapeData(GlassTube)
{
// Must haves
maxDamage = 0.5;
destroyedLevel = 0.5;
disabledLevel = 0.25;
renderWhenDestroyed = true;
debrisShapeName = "~/data/shapes/glass/shard.dts"; // Add shape
debris = GlassTubeDebris; // Link to debris data
};datablock DebrisData(FusionGenDebris)
{
// Display
textureName = -1;
shapeName = -1;
render2D = false;
// Emitters if you wish
//emitters[0] = DebrisSmokeEmitter;
//emitters[1] = DebrisFireEmitter;
//explosion = DebrisExplosion;
// Physical Properties
elasticity = 0.20; // must be between -10.0 and 10.0
friction = 0.5; // must be between -10.0 and 10.0
numBounces = 10; // must be between 0 and 10000
bounceVariance = 0; // must be between 0 and numBounces
minSpinSpeed = 60; // must be between -10000.0 and maxSpinSpeed
maxSpinSpeed = 600; // must be between -10000.0 and 10000.0
gravModifier = 1.0;
terminalVelocity = 0.0;
velocity = 8.0;
velocityVariance = 2.5; // must be less then velocity
lifetime = 30.0; // must be between 0.0 and 1000.0
lifetimeVariance = 0.0; // must be between 0.0 and lifetime
useRadiusMass = true;
baseRadius = 0.5;
// Behavior
staticOnMaxBounce = false;
explodeOnMaxBounce = false;
snapOnMaxBounce = false;
fade = true;
ignoreWater = true;
};
#14
02/16/2005 (2:39 pm)
I am going to try this method out on the vehicles.
#15
Rex
...oh, and would there need to be any collision or LOScol meshes in the DTS shape, to get it to work with a projectile, or is this accounted for. I'll probably set this up tomorrow.
02/16/2005 (4:35 pm)
Hey, I'm curious; what actually gets the animation sequence to work? ...the Damage name of the sequence being the same as the function GlassTube::damage. I like how simple this seems. Milkshape has a nice Explode plugin....;), or the debris route looks good too; but that's just a single DTS shape? that is duplicated per the data block. Thanks.Rex
...oh, and would there need to be any collision or LOScol meshes in the DTS shape, to get it to work with a projectile, or is this accounted for. I'll probably set this up tomorrow.
Associate Stefan Beffy Moises