Game Development Community

Flying Vehicle Resource

by Tom Feni · 01/16/2004 (4:53 pm) · 16 comments

Download Code File

Flyer Vehicle

Created by: Valhalla Entertainment/ The "Chronos V" Team

Web Site: http://www.chronosthegame.com/team.php

Additional Help and Credits:

Chris Timberlake - Scripting help for mount points.

Mathew Jones - Vehicle collision mesh and for cleaning up the model.

--------------------------------------------------------------------------------------------
Files included
flyer.dts
glider.png
flyervehicle.cs
game.cs
racing.mis (changed the spawn points to spawn in the air)
glider.max
flyer.cfg
flyer.3ds (Removed)
*You can get a updated .3ds file from here: http://www.garagegames.com/mg/forums/result.thread.php?qt=15434
*just copy and paste into your browser.
--------------------------------------------------------------------------------------------

unzip the files into the starter.racing folder, the files will go into the right folder. make sure it is a fresh head version. The game will start like a normal race game, with one exception. You will be above the ground about 100 mtrs. I added the max file for people to edit to their own specifications.
I only added basic nodes to get it to run.
mounts I added.
Mount0
Mount1
Cam
Eye
Mass

Feel free to continue what I started.

The max file is for 3dsmax 4

The Berk

#1
01/16/2004 (5:07 pm)
Works good. I will keep it in my bag of "tricks"
#2
01/16/2004 (8:04 pm)
thnx for putting me in teh credits makes me feel real special =) just what i needed to see right now =)
#3
01/21/2004 (1:07 am)
Thanks for this!
#4
06/15/2005 (6:40 am)
Thanks very much. Very useful start point.
#5
06/20/2005 (4:10 pm)
This is exactly what I was looking for, thank you! Strangely, Torque will crash when I collide into an 'interior'. Has anyone else run into this little quirk?
#6
08/02/2005 (11:29 am)
That must be physics integration. You'll want to bring it down, but not down to 0 (that will crash the game too). An ideal level would be about 10.

But that does bring up an interesting point. I have yet to make a vehicle explode or damage on impact, and I'm trying to figure out how to fix that. The minImpactSpeed and speedDamageScale variables don't seem to do anything. :\
#7
12/04/2005 (5:00 am)
Well this was my attempt:

function Drone::onImpact(%this, %obj, %collidedObject, %vec, %vecLen)
{
error("IMPACT!");
%this.damage(%obj, %this.getPosition(), 10000, "Impact");
}

function Drone::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
%obj.applyDamage(%damage);
%location = "Body";

// Deal with client callbacks here because we don't have this
// information in the onDamage or onDisable methods
%client = %obj.client;
%sourceClient = %sourceObject ? %sourceObject.client : 0;

//if (%obj.getState() $= "Dead")
// %client.onDeath(%sourceObject, %sourceClient, %damageType, %location);
}

function Drone::onDamage(%this, %obj, %delta)
{
// This method is invoked by the ShapeBase code whenever the
// object's damage level changes.
if (%delta > 0 && %obj.getState() !$= "Dead") {

// Increment the flash based on the amount.
%flash = %obj.getDamageFlash() + ((%delta / %this.maxDamage) * 2);
if (%flash > 0.75)
%flash = 0.75;
%obj.setDamageFlash(%flash);

// If the pain is excessive, let's hear about it.
if (%delta > 10)
%obj.playPain();
}
}


But it doesnt damage it one bit... (It does say IMPACT! in console though... so that does work)
#8
06/29/2007 (9:51 am)
Thanks vrey much for this!
I have one question though...
How would I go about combining this into the starter fps?
#9
08/04/2007 (6:39 pm)
Vehicle crashes when steered, and crashes when striking ground.
#10
08/05/2007 (5:56 am)
That has been a bug in torque for ages. I never found a good way of fixing it. I had a flying game, where you had to fly to a tunnel. We left the project all togetter because torque simply kept crashing whenever you hit something to hard. It helps changing the physics value in the vehicle datablock so it doesnt crash as fast... but it still does. If anybody has idea's i would love to know them.
#11
10/18/2007 (10:31 am)
When ever I use this, the drone is offset in both the 1st and 3rd person views.
It's kicked over to the right slightly. I've played around with some of the settings
in the script file, but haven't been able to get it to point straight ahead. Is that
the model itself that's causing that? or is it something that can be altered in script?
#12
02/06/2008 (11:35 pm)
Hey, thanks a lot! :)

I just dropped it into TGE 1.5.2... worked perfectly.

EDIT: Oops, just noticed the crashing problem. Gonna try to fix that.
#13
04/25/2008 (5:43 am)
@Chris - did you fix the ground crashing problem?
#14
04/25/2008 (6:02 am)
This works... touch anything at speed and BOOM!
// Object Impact Damage
   collDamageThresholdVel = 100;
   collDamageMultiplier   = 100;   
   minImpactSpeed = 0;         // If hit ground at speed above this then it's an impact. Meters / second
   speedDamageScale = 100;       // war 0.06   
      
   // Misc
   computeCRC = true;

// Damage/Energy
	maxDamage = 350;              // total damage until explosion
	maxEnergy = 180;              // Afterburner and any energy weapon pool
	energyPerDamagePoint = 160;
   destroyedLevel = 1.40;
   rechargeRate = 5.41;          // Afterburner recharge rate
   softImpactSpeed = 0;          // This is a soft hit
   hardImpactSpeed = 0;          // This is a hard hit    

   // Physics
   drag    = 0.2;
   density = 1.0;
   minDrag = 90;                 // Linear Drag (eventually slows you down when not thrusting...constant drag)
   rotationalDrag = 10;          // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag)
   maxAutoSpeed = 15;            // Autostabilizer kicks in when less than this speed. (meters / second)
   autoAngularForce = 15;        // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
   autoLinearForce = 15;         // Linear stabilzer force (this slows you down when autostabilizer kicks in)
   autoInputDamping = 0.95;      // Dampen control input so you don't` whack out at very slow speeds
   maxSteeringAngle = 5;         // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
   horizontalSurfaceForce = 10;  // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
   verticalSurfaceForce = 100;   // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
   maneuveringForce = 6900;      // Horizontal jets (W,S,D,A key thrust)
   steeringForce = 700;          // Steering jets (force applied when you move the mouse)
   steeringRollForce = 12;        // Steering jets (how much you heel over when you turn) 8
   rollForce = 70;               // Auto-roll (self-correction to right you after you roll/invert)
   hoverHeight = 8;              // Height off the ground at rest
   createHoverHeight = 8;        // Height off the ground when created
   jetForce = 7700;              // Afterburner thrust (this is in addition to normal thrust)
   minJetEnergy = 55;            // Afterburner can't be used if below this threshhold.
   jetEnergyDrain = 0.7;         // Energy use of the afterburners (lower number is less drain)   	
   vertThrustMultiple = 10.0;
   integration = 5;              // Physics integration: TickSec/Rate
	collisionTol = 1;           // Collision distance tolerance
	contactTol = 1;             // Contact velocity tolerance
   mass = 100;                   // Mass of the vehicle
   bodyFriction = 0;             // Don't change this.
   bodyRestitution = 0.5;        // When you hit the ground, how much you rebound. (between 0 and 1)
   minRollSpeed = 0;             // Don't change this.
#15
10/04/2008 (11:52 am)
So is this working in TGE 1.5.2 or not?
#16
11/27/2010 (7:16 am)
I just starting, but this looks really cool.