Hello,
Since i can't use Joystick for a Driving LUA demo, i made a c++ code that have a running vehicle based on few posts i saw and a rewrite of the original LUA i had.
Im applying Torque to the vehicle this way:
TVehicle veh=CreateVehicle(chassis);
.....
TMesh tire[4];
.....
// Torque
AddTireTorque(veh, 0, -1);
if (KeyDown(KEY_UP))
{
if (!TireIsAirborne(tire[0])) AddTireTorque(veh, -24, 0);
if (!TireIsAirborne(tire[1])) AddTireTorque(veh, -24, 1);
}
if (KeyDown(KEY_DOWN))
{
if (!TireIsAirborne(tire[0])) AddTireTorque(veh, +24, 0);
if (!TireIsAirborne(tire[1])) AddTireTorque(veh, +24, 1);
}
I can't seem to find a way to check Tire actual torque to be able apply negative Torque until vehicle is stopped.
I'm applying torque only to wheels 0 and 1 becouse i want a front-wheel drive vehicle.
My idea was to make something like this (Anyway applying 0 torque will do nothing, but if apply negative it will go backwards after stopped):
// BRAKE
if (KeyDown(KEY_SPACE))
{
if (!TireIsAirborne(tire[0])) AddTireTorque(veh, 0, 0);
if (!TireIsAirborne(tire[1])) AddTireTorque(veh, 0, 1);
}
Also Is there a way to calculate some kind of speed with raycastvehicle?
Anybody implemented some kind of Engine to do gears and stuff?
Thanks a lot in advance