0
votes

I develop a game using Box2D in Cocos2d-x with Xcode and iPhone simulator. I apply a upper force to a body in a b2World(gravity 0.0f, -10.0f), and I find that the body fly up to different height each time. When b2World has many bodies, the problem more likely to occur. enter image description here And, I also want to ask how does following function set with velocityIterations and positionIterations.

world->Step(dt, velocityIterations, positionIterations);

Thank you.

1

1 Answers

0
votes

Maybe you apply force to different point of body. So part of force goes to rotation and part of force goes to moving up. velocityIterations, positionIterations just increase accuracy, I think you can use world->Step(dt, 1, 1);