Game Development Community

Any tips for vehicle "nitro boost

by Ben R Vesco · in Torque Game Engine · 03/02/2006 (10:02 pm) · 3 replies

I haven't been able to find any resources or tips in the forums on implementing a nitro boost for vehicles. Does anyone have any good tips on where to look or how to go about it?

Thanks.

#1
03/03/2006 (2:08 am)
Try looking for the dynamic speed player resource (use the search)...

Then bind a key that changes the maxTorque to something higher in a similar
way.

Or if you're looking for a Nitro quick boost, as was found in Ironman....
just use the applyImpulse function on the car in a fwd direction...
This could have interesting results, depending on how much Impulse you apply.... ;-)

Start there... then worry about how long it lasts or how many boost a player has later.
#2
03/03/2006 (2:13 am)
function Boost(%data, %obj, %force)
{
   %vel = %obj.getVelocity();
   if(getWord(%vel, 0) < 0.2 && getWord(%vel, 1) < 0.2) return;
   %vel = VectorNormalize(%vel);
   %x = getWord(%vel, 0) * 1;
   %y = getWord(%vel, 1) * 1;
   %z = getWord(%vel, 2) * 0; // get rid of the z vector
   %brake = %x SPC %y SPC %z;
   %mass = %data.mass;
   %amount = %mass * %force;
   %obj.applyImpulse(%obj.getTransform(), VectorScale(%brake, %amount));
}

%data is the Vehicle Datablock, $obj is the Vehicle, %force is the amount of impulse force
#3
03/04/2006 (8:25 am)
I'm going for more of the "Ironman" type of quick boost. That little boost function from Josh is a great starting point. Thanks tons.