The problem is intermittent, but the general pattern is that the btRaycastVehicle that I am working with will work fine as long as I move it within a few seconds of the application starting. If I move it, it works beautifully. If I wait, it will not budge, despite successful messages from the lines exerting it. The relevant code is this:
This is the update function. It gets called every cycle and passed the elapsed time (inputTime). User actions set the targetEngineForce, which is applied until the maxSpeed is reached, then the brake slows it down again.
Code: Select all
if(fabs(palletJackBotVehicle->getCurrentSpeedKmHour())>(maxSpeed*3.6))
{
printf("0 Speed control: Setting the engine force to: %f\n",0.0);
for(int i=0; i<4; i++)
{
palletJackBotVehicle->applyEngineForce(0,i);
}
}
else
{
printf("1 Speed control: Setting the engine force to: %f\n",targetEngineForce);
for(int i=0; i<4; i++)
{
palletJackBotVehicle->applyEngineForce(targetEngineForce,i);
}
}
printf("I'm updating! Vehicle speed is: %f\n",palletJackBotVehicle->getCurrentSpeedKmHour());
palletJackBotVehicle->updateVehicle(inputTime);
I tend to suspect my code far more then Bullet's, though I have checked and this is the only portion of code that touches the force settings.
Does anyone know what might be going on?