Game Development Community

Small Flying vehicle fix

by Sam Guffey · in Torque Game Engine · 09/09/2003 (11:22 pm) · 3 replies

I dont know about you but something wasnt right about the flying vehicles. They kept decending once you stopped and started to hover, it didnt seem to be reading the hoverHeight variable, so I took a look.

I found that the getHeight() function wasnt defining a mask for the rayCast info thus was always returning a value of 1. So, if we add the mask info then the flyer will know once it is near something.

In flyingVehicle.cc find the getHeight() function..

Add the following after disableCollision()
U32 mask = TerrainObjectType |           
              InteriorObjectType |                                 
              StaticShapeObjectType |       
              PlayerObjectType |                       
              VehicleObjectType;

Now in the castRay call make it look like this..

if (!mContainer->castRay(sp,ep,mask,&collision))

That will keep your ships from hitting those masks and apply the hover correctly to the flyer.

Sam aka -Liquid-

#1
09/10/2003 (6:55 am)
Mmm, will try that ASAP.
#2
06/29/2004 (7:28 pm)
Hey Sam / -Liquid-:

I tried this in my game, and I saw some very odd behaviour, might interest you:

The vehicle seemed to be swaying happily from side to side, and then when I stopped, it suddenly went into a tight roll.. the world spinning around it.. and nothing brought it back to level.

The hoverHeight annd createHoverHeight are both 45, if that's relevant (and the mass is about 5.. I'm trying to create a sub which floats stationary in the air and doesn't sink.. this sinks slowly.)

-AP
#3
06/30/2004 (1:01 am)
That sounds like a "rotationalDrag" problem, the Tribes 2 setting for this was at 900 but for Torque it should be set to about 20-25. Check the vehicles datablock and see what this variable is at. Also, with a mass of "5" you may see problems like this with the rigid body. Remember the density is what makes things sink or float, not mass.