Code: Select all
//world->stepSimulation(deltaMS / 1000.0);
world->stepSimulation(0.05,1,0.05);
if(car->getCurrentSpeedKmHour() > someValue)
//if(car->getRigidBody()->getLinearVelocity().length() > someValue)
{
car->getWheel(0).applyEngineForce(someOtherValue);
car->getWheel(1).applyEngineForce(someOtherValue);
}
btVector3 pos = car->getRigidBody()->getWorldTransform().getOrigin();
float changeInPos = pos.x() - lastPos;
lastPos = pos.x();
std::cout<<"Change in pos: "<<changeInPos<<" Velocity: "<<car->getRigidBody()->getLinearVelocity().x()<<"\n";
Code: Select all
Change in pos: 4.2 Velocity 250.0
Change in pos: 4.1 Velocity 250.0
Change in pos: 3.9 Velocity 250.0
Change in pos: 4.2 Velocity 250.0
Change in pos: 3.7 Velocity 250.0
Change in pos: 4.5 Velocity 250.0
Change in pos: 4.3 Velocity 250.0