Game Development Community

Destroyable Objects in latest T3D Binary [3.0]

by Rex · in Torque 3D Professional · 08/27/2014 (2:24 pm) · 11 replies

Did the damage/debris bugs get worked out in the latest T3D MIT build? I'm looking for a 'simple' destroyable static or item object.

I worked with Mike Hall a few years ago for his Resources on just this subject, and am wondering what is needed to get 'damage' applied to objects and 'Destroyed' state to create the explosion and debris objects. Art is NEVER a problem with me, it's the scripting that seems to catch me up. And it's been a few years since I've actually developed in T3D, so I'm on the verge of getting it. I'm at the vmWare conference in San Francisco and am working backstage with too much spare time and want to get some developing going...;).

Any help?

Thanks!!

Rex

About the author

Rex does all his 3D graphics through BrokeAssGames and is currently working on DSQTweaker, Ecstasy Motion, and other interesting projects yet to be revealed. Just ask him about anything DTS/DSQ related, he's happy to help.


#1
08/27/2014 (2:51 pm)
shapebase::blowup() was exposed to script again a bit back (wanna say 3.5?) by Daniel Buckmaster.

It's turning into a running gag at this point that I keep meaning to break https://github.com/Azaezel/Torque3D/tree/material_damage off into a proper feature instead of an override for per-object damage influencing a texture overlay (overrides the detail map there), before I turn that into a PR.

Got a list of the rest? (Never for instance messed with the damage thread personally, though from the internal docs, it said something about being able to deform the visual shape as they took damage as I recall, not the physical one.)
#2
08/27/2014 (3:01 pm)
Well, thanks, Azaezel. I'm looking for some simple script[item probably] that generates a 'destroyable' object. I've got the art ready, just need to get it inserted in 'some' script that is 'easiest/quickest' to iterate. Any working example would work. I don't want to think this tru; just want to demonstrate an 'exploding' object that takes damage, shows bullet decals, and then explodes. I'll substitute paths and so on....just need an object scripted with the necessary stock functions....trying to get this demonstrated by 10pm PST today!!!
#3
08/27/2014 (3:07 pm)
well, there's:
datablock RigidShapeData(railing_destructable)
{
   classname = "destructableEnvironmentData";
   bodyRestitution = "0.1";
   bodyFriction = "1";
   minImpactSpeed = "5";
   softImpactSpeed = "5";
   hardImpactSpeed = "15";
   minRollSpeed = "10";
   maxDrag = "0.5";
   minDrag = "0.01";
   integration = "4";
   dragForce = "0.05";
   vertFactor = "0.05";
   triggerDustHeight = "1";
   dustHeight = "10";
   shapeFile = "art/shapes/destructables/environment/rail/railing_destructable_rail.dae";
   debrisShapeName = "art/shapes/destructables/environment/rail/railing_destructable_debris.dae";
   debris = railing_destructable_debris;
   icon = "art/gui/playgui/blank_icon.png";
   mass = "2000";
   drag = "0.2";
   category = "destructable";
   maxDamage = "100";
   density = "400";
   botHate = 1;
   hideIcon = true;
   debrisRepeat = 4;
};

function railing_destructable::onAdd(%this,%obj)
{
	Parent::onAdd(%this,%obj);
	%obj.team = 1;
	%obj.freezeSim(true);
}

function railing_destructable::onCollision(%this, %obj, %col, %vec, %vecLen)
{
	for (%i=0; %i<%this.debrisRepeat; %i++)
	{
		%obj.blowUp();
	}
	
	%obj.schedule(320,"delete");
}

datablock DebrisData( railing_destructable_debris )
{
   explodeOnMaxBounce = false;

   elasticity = 0.15;
   friction = 0.5;

   lifetime = 20.0;
   lifetimeVariance = 10.0;

   minSpinSpeed = 40;
   maxSpinSpeed = 600;

   numBounces = 10;
   bounceVariance = 0;

   staticOnMaxBounce = true;
   gravModifier = 2.0;

   useRadiusMass = true;
   baseRadius = 0.25;

   velocity = 10;
   velocityVariance = 0.0;
};

Using that for a pseudo-cinematic this end. (Bots enter from behind rails, bots run into rails, bots blow up rails.) should be simple enough to extend to the normal damage tracking bit since samples of that are everyplace.
#4
08/27/2014 (3:38 pm)
Thanks, that should get me going.....
#5
08/27/2014 (4:45 pm)
Hi, Rex. Long time no see. :)
#6
08/27/2014 (7:18 pm)
Ya, been quite some time, Steve-O.... you got anything 'simple' that works, out of box? Static shape or anything; Item class doesn't seem to get my bullet decals, which is what I would also like?!? Rigid Shape also seems to hate projectile explosion decals....

As is, I'm gonna have to script in the ShapeBase functions....mighty tired at this point, doing 14 hr days this week. Big Rock-N-Roll party tonight at the Moscone Center for vmWare, Whoo Hoo!!!
#7
08/28/2014 (5:09 am)
StaticShape with it's own internal collision mesh should show decals up.

Here's Mike's tutorials - bottom left - on the subject.
www.garagegames.com/products/torque-3d/guides
#8
08/28/2014 (7:30 am)
I'm trying that, just can't get decals showing up on my LOSCol meshes?!?

Very odd, only certain meshes will get decals. I've got 6 objectDetail meshes, 6 COL meshes, and 6 LOSCol meshes. All collision meshes work, but only certain LOSCol meshes get decals. Didn't even get to damage part, lol. The Black Keys were playing the party so I stepped out of my black box and watched some of the show.

May try later today to actually get something to explode, guess I'll have to KISS it and start with a crate, LOL.
#9
08/28/2014 (8:32 am)
Ah, errors with the Hall guide, no more 'SwarmGun' in the Project, very near the end here, and some textures moved in the Particles folder.....Woo Hoo! Don't think my collision meshes exceeding bounds is a real gameStopper, the vehicle does it as well; perhaps some art tweek needed as well.
#10
08/28/2014 (9:19 am)
Success!!! After fixing the pathing, touching up my Bounds box[not a gameStopper, as I thought], and fixing my nameSpace changeover No-No[Item cannot become StaticShape, d'oh!], even with the LOSCol oddity[not all working for projectiles, just 2 of 6], the Object essploded on cue!!

Also my static shape namespace negated the Item stock rotation member field, which I did find later in the /Server/Item.cs. I took a great deal of ribbing as to why my object spun continuously and didn't do much except sit there. Now, when the laugher comes in I can proudly demonstrate how quickly you can get some stuf werking...
#11
08/28/2014 (4:52 pm)

HUZZAR


Congrats on getting it to work, Rex. :)