How to stop the forces acting on a body in box2d How to stop the forces acting on a body in box2d xcode xcode

How to stop the forces acting on a body in box2d


Box2d automatically clears the forces each simulation step. I think you are just changing your body's position when resetting, but not its velocity. Add this code to your reset method:

body->SetLinearVelocity(b2Vec2(0,0));body->SetAngularVelocity(0);