Game Development Community

help with debris?

by deepscratch · in Torque 3D Professional · 06/24/2009 (7:17 am) · 8 replies

hi all,
why is it that anything of the debris class, when coming to rest in the world, always seems to stick halfway into the ground?
is there a way to fix this?
my debris models have bounding and collision boxes, and their points of origin are not the centre of the models, so it cant be that.
help?
thanks

img199.imageshack.us/img199/8864/debriso.jpg

#1
06/24/2009 (8:17 am)
If you're using ShapeBase::blowUp() and you have a partList it's going to stick pieces in the ground by default.

debris.cpp, Debris:onAdd (line 456 of Beta 2):
if( mPart )
   {
      // use half radius becuase we want debris to stick in ground
      mRadius = mPart->getRadius() * 0.5;
      mObjBox = mPart->getBounds();
   }

It's kind of what looks like is happening.
#2
06/24/2009 (9:10 am)
ok, but what is "getBounds"?
"boundingBox" defined in script? or "bounds" as exported from modeling program?
#3
06/24/2009 (9:15 am)
To me this looks suspiciously similar to the wheels-sunk-halfway-into-the-ground problem that I've seen with terrains and groundplanes. There's been a thread about that problem some time ago, too.
#4
06/24/2009 (9:20 am)
no, I dont think so, I believe its debris related, the wheels are "debris" ejected from a vehicle explosion. if the vehicle body debris happens to land nose first, it also embeds its self to the half way mark.
looks really dumb, I'm trying to get a bit more realism.
maybe if I could spawn the debris as "items"? it may work.
dunno how I would do that, but I really need to fix this.
#5
06/24/2009 (9:25 am)

Not similar because there's wheel objects here, but because there may be a collision issue on a more general level. For some reason, the wheels of a vehicle may end up sunk halfway into the ground. That looks like a collision system problem. The same may be happening here.
#6
06/24/2009 (9:31 am)
I could be wrong here but I believe that Debris files will try to use the Z position of the sub-mesh in the DTS as the masss and also as a targetted "end" goal.

ie) If youre tire is placed at 0,0,0 in your DTS file, which would make it half sunk into the negative Z, then the engine will try to rest this sub-mesh object at the same Z position.
#7
06/24/2009 (9:39 am)
so how to work around that?
if I set the point to the bottom of the mesh
and if I have "snapOnMaxBounce = false;", because I dont want it to snap,
then if the debris lands upside down, it wont be visible at all!
see the problem?
#8
06/24/2009 (10:48 am)
You should turn off all rotation on your debri datablock if you want it to look even halfway decent.