How to get the current speed of a box2d object

I apply force to b2body, but would like to know if there is a way to find out what speed b2body is after applyforce / applylinearimpulse?

b2Body* car;
b2Vec2 force = b2Vec2(0,100);
car->ApplyForce(force, car->GetPosition());
+3
source share
2 answers

b2Vec2 vel = body-> GetLinearVelocity ();

+8
source

After applying force to the center of mass:

v = F * t / m. F - force, m - body weight, t - application time. I think this will give a good approximation if damping is not used.

I'm not sure about the momentum. But, imp = m * vSo, applying a linear impulse to the center of mass, you get a imp/bodyMassspeed increment

-1
source

All Articles