Game Development Community

Brake, car

by Amarnauth Sukhu · in General Discussion · 12/10/2006 (4:54 pm) · 3 replies

Does anyone know how to stop a car?

I have a player, and a car. I was able to sucessfully mount the player to the car, but when i am trying to apply the handbrake the camera rotates and the car wont slow down, this is my method for handbrake:
function handbrake(%val)
{
   $mvTriggerCount2++;
}
vehicleDriverActionMap.bind(keyboard, "space", handbrake);


.....

#1
12/10/2006 (4:59 pm)
Also, does anyone know how to activate the "thrust", of the car?
#2
12/10/2006 (6:24 pm)
$mvTriggerCount2++;

By default trigger 2 is used for the player jump. It is also used for the handbrake in a car (wheeledVehicle). This isn't a problem if the car is the control object however in your case you're mounting a player to the car, meaning that calling trigger 2 will try to play the player's jump as opposed to the car's handbrake (as the player is the control object).

A simple work around would be to delve into wheeledVehicle.cc and make this minor adjustment:

approx line 631
void WheeledVehicle::updateMove(const Move* move)
{
   Parent::updateMove(move);

   // Break on trigger
   mBraking = move->trigger[3]; // shift handbrake to trigger 3

Then adjust your handbrake function to suit:
function handbrake(%val)
{
   $mvTriggerCount3++;
}
vehicleDriverActionMap.bind(keyboard, "space", handbrake);
#3
12/10/2006 (7:41 pm)
The camera stopped rotating, but now, it doesn't do anything.
It doesn't slow down the car.
I recompiled the engine.

any suggestions?