Game Development Community

Flying Vehicle problem

by Chosen.Kyle · in Torque Game Engine · 10/25/2005 (5:55 am) · 5 replies

For some reason my flying vehicle used from this resource: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5071 does not seem to be effected by gravity in other words it does not fall to the ground, I have also removed hover and sethover height though no difference is made. Is there something im missing?

#1
10/25/2005 (7:03 am)
I dont know if you're missing something but I'll add that I tried a flying vehicle resource from this site as well. I also noticed that the vehicle doesnt exhibit the effects of gravity so youre not alone. its fine for the hover vehicle but i thought it was kinda strange that an airplane made using a default setup would simply sit in the air when its not moving. im thinking you may have to script the effects of gravity which shouldnt be too hard.
#2
10/26/2005 (7:39 pm)
Okay so I really was wondering the fix to this, hopefully someone will notice this topic this time
#3
10/26/2005 (8:23 pm)
Did you delete the .dso files?
#4
03/09/2006 (5:57 am)
Do you guys have the problem that the flying vehicle goes a bit crazy if you fly into the ground or colide with something? I heard that people have solwed it but I have not managed to find information on how to do it.
I am probably searching with the wrong words or something and some help would really be appreciated =)
The resource is the same as the one Kyle use.
#5
03/09/2006 (3:56 pm)
Gotland#5,

Here goes a patch made by Wendell Brown that I beleive will solve this :


Some modifications weren't included since they only contained comments

IN THE ENGINE :

################## In FlyingVehicle.cc

Locate : ( line 32 )
static U32 sServerCollisionMask = sCollisionMoveMask; // ItemObjectType
 static U32 sClientCollisionMask = sCollisionMoveMask;
 
 static F32 sFlyingVehicleGravity = -20;

replace :
static F32 sFlyingVehicleGravity = 0;

locate : ( line 256 )
FlyingVehicle::FlyingVehicle()
{
   mGenerateShadow = true;

   mSteering.set(0,0);
   mThrottle = 0;
   mJetting = false;

replace :
mJetting = true;

locate : ( line 282 )
bool FlyingVehicle::onAdd()
{
   if(!Parent::onAdd())
      return false;

INSERT :
bool FlyingVehicle::onAdd()
{   
   mDistanceFactor = 1.0f;
   if(!Parent::onAdd())
      return false;

locate : (line 426 )
currPosMat.getColumn(0,&xv);
   currPosMat.getColumn(1,&yv);
   currPosMat.getColumn(2,&zv);
   F32 speed = mRigid.linVelocity.len();

replace :
F32 speed = mRigid.linVelocity.len() * mDistanceFactor;

locate : ( few lines bellow )
// Drag at any speed
   force  -= mRigid.linVelocity * mDataBlock->minDrag;

replace :
F32 slamit = (mDistanceFactor > 1.0) ? 1.0f : 1.0f/(mDistanceFactor*mDistanceFactor+.01);
   slamit = mClampF( slamit, 1.0f, 60.0f);
//      Con::errorf(ConsoleLogEntry::General, "slamit=%f", slamit);
   force  -= mRigid.linVelocity * mDataBlock->minDrag * slamit ;

################## In FlyingVehicle.h

locate : ( line 101 )
class FlyingVehicle: public Vehicle
{
   typedef Vehicle Parent;

   FlyingVehicleData* mDataBlock;

   AUDIOHANDLE mJetSound;
   AUDIOHANDLE mEngineSound;

   enum NetMaskBits {
      InitMask = BIT(0),
      HoverHeight = BIT(1)
   };
   bool createHeightOn;
   F32 mCeilingFactor;

INSERT
public :
	   F32 mDistanceFactor;
private: