Game Development Community

Bravetree tankpack falling through terrain issues

by Dave D · in Torque Game Engine · 01/05/2005 (9:42 am) · 9 replies

I recently purchased the TankPack from Bravetree, however I noticed that the tank will fall through the terrain when it impacts the ground to hard. I search the forums and found a similar problem that a guy was having with a hover vehicle. The resolution was to set, in the datablock for the vehicle, integration to at least 5. I also tried this but to no success. Any help or ideas would be appreciated.

#1
01/06/2005 (2:59 am)
Fail66,

I have a solution for you, but I don't have the tank pack. We have a HUMMV in our mission and If I set the mass too high the vehicle will get stuck in the terrain. I did some poking around in the code and came up with this solution:

in vehicle.cc, void Vehicle::processTick(const Move* move) right after:

// Wrap up interpolation info
      mDelta.pos     = mRigid.linPosition;
      mDelta.posVec -= mRigid.linPosition;
      mDelta.rot[1]  = mRigid.angPosition;

add

//keep vehicle above ground MCOX
   Point2F pos;
   pos.x = mDelta.pos.x;
   pos.y = mDelta.pos.y;

   F32 height = 0.0f;
  
   TerrainBlock * terrain = dynamic_cast<TerrainBlock*>(Sim::findObject("Terrain"));
   if(terrain)
      if(terrain->isServerObject())
      {
         Point3F offset;
         terrain->getTransform().getColumn(3, &offset);
         pos -= Point2F(offset.x, offset.y);
         terrain->getHeight(pos, &height);
         if (mDelta.pos.z < height)
	mDelta.pos.z = height;
      }

Now if the vehicle goes below the ground it will move above ground and it will do this every tick. I don't know that much about C++ so this may be a bit of a hack, but it works great for us. I hope it works for you too.

Marrion
#2
01/06/2005 (3:06 am)
@Flail66 I noticed this as well. Only when making the max speed above 9.9 or when dropping a tank from a high altitude.

I don't know what to tell you. I'm not sure why it happens.
#3
01/06/2005 (5:32 am)
It happens to me too.
#4
01/06/2005 (6:22 am)
I've modified 4 of my tanks to use this pack. And 3 work fine and one of those 3 had a speed set at 15.9

The 4th tank has been problems--and it falls through the terrain as well. It has a speed of 9.9. (I'll have to change the 9.9 to what happens) I had to set the maxstep to 10 to just get it to spawn on the terrain. Anything less and it would fall through.

So, I'm thinking there is something wrong with my model (transform/scale/something) didn't get reset in max.

I don't wanna go hack code cause if 3 of my tanks work why not the 4th.
#5
01/06/2005 (6:44 am)
Cool!It seem to no problem after I set the maxstephigh to 10 (actually set it over 1 can do same result,I don't know why.),I set the maxspeed over 50,It still has no problem.
@Steve ,thanks!
#6
01/06/2005 (12:25 pm)
Thanks, I will try it out in a bit. I just woke up. I will post my results. Thank you for your reply.
#7
01/06/2005 (6:31 pm)
I got it fixed. I set the maxstephigh to 10, and it didn't fall through. Thank you.
#8
01/05/2006 (6:39 pm)
The parameter is in TankDB.cs and is
maxStepHeight = 10
It works for me as well.

Thanks Steve for pointing out the solution and thanks Fail for pointing out this thread. Now I can speed up my tanks :)
#9
01/14/2007 (2:50 am)
We need definately a tank pack owners forum.