btRaycastVehicle::setBrake() value unit ?

gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

btRaycastVehicle::setBrake() value unit ?

Post by gjaegy »

Hi,

by trying to understand what unit and order of magnitude the value passed setBrake() should be, I noticed something interesting in btRaycastVehicle::updateFriction().

Basically, the rolling friction is either computed using the engine force (if not null), otherwise it is computed using the value set using setBrake().

In the first case, the engine force is a force (!), hence multiplied by the time step. In the second case, the value set using setBrake() is considered as an impulse.

Is there a reason not using force for both ?

cheers,
Gregory
gjaegy
Posts: 178
Joined: Fri Apr 18, 2008 2:20 pm

Re: btRaycastVehicle::setBrake() value unit ?

Post by gjaegy »

Hmm, it seems this question is still causing me problems.

Hasn't anybody any clue ?

According to my tests, in order to get the same braking independently from the framerate, one has to use the following:

Code: Select all

pVehicle->setBrake(fBrakingForce * fixedTimeStep, wheelID);


with "fixedTimeStep" being the same value used as 3rd parameter when calling:

Code: Select all

btDiscreteDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.));