Game Development Community

Hovervehicle trouble... step by step

by Kirby Webber · in Torque Game Engine · 01/04/2003 (1:06 pm) · 6 replies

Since the other thread was getting long, and a little confoosing, I decided to start a new one.

To begine, I have a completely clean and fresh install of v 1_1_2 that I am now working with.

I have brought the same hovervehicle in and got it running. In order to simplify things, I am going at this one problem at a time. First I would like to enable turbo/ jetting.

So that I can be sure that I am not missing anything let me breakdown the model specs:

Vertices: 270
Triangles:460

Meshes*******
body
fairing
Col-1

Nodes********
eye
mass
mount0 //currently not being used as the vehilce IS the
         conn object.
collision-1
cam

//I ran an experiment with a jetNozzle node for forward thrust, but this had no discernable effect.

Now from what I have gleaned from the vehicle tutorials I have found, all of the essential nodes and meshes are present. Incidentally, this is working from a MilkShape export, which from what I understand does not support the LOD meshes. *Correct me if I am wrong PLEASE! ;)*

Now, in order to keep things nice an convenient, here is the datablock I am currently using for my hovervehicle. [NOTE:] There are no damage() or onDamage() methods as I am not going to be working on that for now.

//*****************************************************
// VEHICLE CHARACTERISTICS
//*****************************************************
datablock HoverVehicleData(HoverCycle)
{
   //standard variables********************
   spawnOffset = "0 0 1";
   floatingGravMag = 2.25;
   
   //load model/ information***************
   catagory = "Vehicles";
   shapeFile = "~/data/shapes/cycles/banshee.dts";
   emap = true;
   computeCRC = true;
   
   //damage information********************
   debrisShapeName 
   = "fps/data/shapes/player/debris_player.dts";
   debris = playerDebris;
   renderWhenDestroyed = false;

   //resistance information****************
   drag                   = 0.0;
   density                = 0.9;

   //camera variables**********************
   cameraMaxDist          = 5.5;
   cameraOffset           = 0.8;

   //damage variables**********************
   maxDamage              = 3.00;
   destroyedLevel         = 3.00;
   
   //energy variables**********************
   jetForce               = 200;
   maxEnergy              = 100;
   rechargeRate           = 0.25;
   minJetEnergy           = 15;
   jetEnergyDrain         = 5.0;

   //rigid body****************************
   mass                   = 1.0;
   bodyFriction           = 0.1;
   bodyRestitution        = 0.75;
   minImpactSpeed         = 20;
   softImpactSpeed        = 10;
   hardImpactSpeed        = 25;
   speedDamageScale       = 0.008;

   // Object Impact Damage (uses DamageType::Impact)
   collDamageThresholdVel = 23;
   collDamageMultiplier   = 0.030;

   //Handling Info**************************
   dragForce              = 25 / 45.0;   //*
   vertFactor             = 0.0;         //*
   floatingThrustFactor   = 0.37;        //*
                                         //*
   mainThrustForce        = 37.50; //(35)//*
   reverseThrustForce     = 10;          //*
   strafeThrustForce      = 15;          //*
   turboFactor            = 2.0;         //*
                                         //*
   brakingForce = 25;                    //*
   brakingActivationSpeed = 4;           //*
                                         //*
   stabLenMin             = 2.25;        //*
   stabLenMax             = 3.25;        //*
   stabSpringConstant     = 30;          //*
   stabDampingConstant    = 12;          //*
                                         //*
   gyroDrag               = 16;          //*
   normalForce            = 30;          //*
   restorativeForce       = 20;          //*
   steeringForce          = 27.50; //(25)//*
   rollForce              = 15;          //*
   pitchForce             = 7;           //*
   //Handling Info**************************
   
   //dust emitter***************************
   dustEmitter = LifterDustEmitter;
   triggerDustHeight      = 3.5;//2.5
   dustHeight             = 0.2;
};

//*****************************************************
//METHOD DATABLOCKS
//*****************************************************
//-----------------------------------------------------------------------------
function HoverCycle::onAdd(%this,%obj)
{
   // Setup defualt energy values
   %obj.setEnergyLevel(%this.maxEnergy);
   %obj.setRechargeRate(%this.rechargeRate);
}

Next, as per Badguys' tutorial in the resources section I added the following to default.bind.cs:
function mouseJet(%val)
{
   $mvTriggerCount3++;
}

moveMap.bind( mouse, button1, mouseJet );
//moveMap.bind( mouse, button1, altTrigger );

Now when I run the demo, there is still no jet/ turbo functionality.

Entering echo(1401.getEnergyLevel()); in the console returns the full energy amount as defined in script. It does not decrement what-so-ever.

I appreciate the help that has allready been offered, and would ask for your continued patience. I know that if I keep at it, the lightbulb will go on. I'm sure I'll feel like an idiot when it does, but "Better an informed idiot, than a clueless genius" I always say! ;)

Thanks again for any and all help.

#1
01/04/2003 (1:48 pm)
ok.
do you have any hud that shows vehicle energy level?
there is a nice enuff one in the resources somewhere quick to add
it will show you a meter representing the energy this is a no fail way to see if you have energy
otherwise you will have to use:
echo([vehicleid].getenergylevel());

if indeed you have energy and the bind is working
(you can double check that by hacking in a echo into the mousejet)

your gonna have to use the debugger
ctrl f10 where the energy is being used.
everything looks in order you should have a jet

this is not head open the vehicle.cc approx line 861
check what trigger is being used :
if (move->trigger[3])
is what it looks like in the head.
the number there is the number of trigger you want to use in mouseJet

ps: 200 boost is not much.
#2
01/04/2003 (2:19 pm)
BadGuy: Yes I installed the guiVehicleHealthbar.cc file and added it to my playGui. The energy shows up, both in the hud as well as the console echo().

I am not sure how to go about hacking an echo into mouseJet as you suggested, though I can't imagine what would override the bind.

Also, when you speak of using the debugger, do you mean within the debug build? I am currently modifying the release build and ctrl+F10 just opens the gui editor! LOL

I also checked the source, and as you have described, Trigger[3] is being called to enable jetting.

Incidentally, you are NOT a "badguy" IMO. ;-) Thanks for the help.
#3
01/04/2003 (2:32 pm)
I GOT IT! YEEEEEEEEEEEEESSSSSSSSS!!!!!

Oh man... what a relief! SWEET!

Here was the problem, I had not added the following to config.cs:

moveMap.bind(mouse0, "button1", mouseJet);
Everything is working now. Thank you SO much!

I will be playing with this for a while so, I'll post again when I hit the next problem!

Thanks again!
#4
01/04/2003 (2:41 pm)
good stuff glad you got it werkin :)

when I said hack in an echo I simply meant to put
echo("Function Called");
into the script function mouseJet which would have helped you realize the function was not getting called :)


when I said ctrl F10 that will "Step" into the code at the point where your cursor is.
you would need to be using a Debug build and have the source code handy
#5
01/05/2003 (12:14 am)
Yeah, thanks in LARGE part to you! ;-)

Remember when I said I'd post when I hit the next obstacle? Well... guess what! LOL

Here's the deal, I have defined all of the necessary methods (as far as I can tell) to impliment damage and death in the racing mod.

I have declared: onImpact() damage() and onDamage() which all seem to be required when dealing with vehicle damage in the racing mod.

Now, my health bar decrements and when it reaches zero, the vehilce stops rendering (invisible) and the debris activates, but the d@mn thing just won't die!

I echoed the object in the console and the damageState returns "Destroyed".

Now I am at a total loss?! Any thoughts?
#6
01/05/2003 (12:29 pm)
Whoa... nevermind... I got it!

Thank you guys for all of your help! Thanks again BadGuy. Your ifno has been invaluable! You are a great addition to the community! ;-)