When accelerating, using auto gears, I can see the vehicle decelerate during the switch time, but the new gear is still eFIRST,
So the current gear is always eFIRST.
What can cause this, please ?
Thanks
[EDIT]
Here’s the code of the input :
int g=((PxVehicleDrive4W *)v->physicsModel->vehicle)->mDriveDynData.getCurrentGear();
ODS_int(g);
float speed=v->physicsModel->vehicle->computeForwardSpeed();
if (fabsf(speed)>0.1f && ((engine.input.keyboard[VK_UP] && speed<0.0f) || (engine.input.keyboard[VK_DOWN] && speed>0.0f)))
{
v->physicsModel->input.setDigitalAccel(false);
v->physicsModel->input.setDigitalBrake(true);
}
else if (engine.input.keyboard[VK_UP])
{
if (g<2) ((PxVehicleDrive4W *)v->physicsModel->vehicle)->mDriveDynData.forceGearChange(2);
v->physicsModel->input.setDigitalAccel(true);
v->physicsModel->input.setDigitalBrake(false);
}
else if (engine.input.keyboard[VK_DOWN])
{
if (g) ((PxVehicleDrive4W *)v->physicsModel->vehicle)->mDriveDynData.forceGearChange(0);
v->physicsModel->input.setDigitalAccel(true);
v->physicsModel->input.setDigitalBrake(false);
}
else
{
v->physicsModel->input.setDigitalAccel(false);
v->physicsModel->input.setDigitalBrake(false);
}
… and when accelerating with starting gear=eFIRST, g is always eFIRST (2)
[EDIT2]
My mistake, I didn’t notice eNEUTRAL (1) was applied when switching gears, so changing :
if (g<2) ((PxVehicleDrive4W *)v->physicsModel->vehicle)->mDriveDynData.forceGearChange(2);
with
if (!g) ((PxVehicleDrive4W *)v->physicsModel->vehicle)->mDriveDynData.forceGearChange(2);
solved the problem.
Thanks anyway.