Total force on rigid body

mcan
Posts: 15
Joined: Tue Feb 03, 2009 10:04 am

Total force on rigid body

Post by mcan »

Hello.

To make something move the applyed force on the object needs to be greater than the "resisting or breaking" forces. Now I have a vehicle simulator where I need that force for calculations in my engine model. So my thought were to take the rigidBody.getTotalForce() and dot it with the forwardVector of my vehicle.

However, the getTotalForce returns a vector with length 0.000 (or sometimes -0.000).
Does anyone have any idea of what I should do?
mcan
Posts: 15
Joined: Tue Feb 03, 2009 10:04 am

Re: Total force on rigid body

Post by mcan »

Ok, so I managed to find out that clearForces() is called at the end of stepSimulation in descreteDynamicsWorld. Ok, so the next question would be: is there any callback in between the clearForces() and someplace where all the forces has been added properly?

The totalForce shall be used to calculate the RPM of the engine who is dependant on the external forces ie. an uphill, and a wind resistance. The wind resistance is applied by be so that would be easy enough to extract. But the slope resistance would be a little bit harder, it's also possible that some other force that I haven't thought about could contribute to the total force.

(Total force could be implemented in such a way that it isn't applicable to my application anyways, please tell me so in that case)
mcan
Posts: 15
Joined: Tue Feb 03, 2009 10:04 am

Re: Total force on rigid body

Post by mcan »

So for those of you who might be interested...

I didn't find any such callback. I found the internalTickCallback, but that didn't seem to have all the forces added or evaluated...

So I made a subclass to btRigidBody that stored the m_totalForce in a m_oldTotalForce vector which were evaluated when the clearForces() function were called on the rigidBody. I where very pleased with this solution until i discovered that the totalForce variable didn't seem to be implemented the way I thought... :(

So now I'm going to use the attitude and the mass of the vehicle and add the wind resistance to calculate the restisting force.