1
votes

I am developing a box2d game. The world's scale is set at 30 units to one meter. The body size is one meter. Other parameters: density = 1; friction = 0.5f; restitution - 0.5f. I found that the object has been at a constant angular velocity after the collision. I also found that some bodies jitter. Different body paramenters lead to different performance. Why do you think this is the case?

1
Need a little bit more data to go by. What do you mean a different performance ? FPS drops or just the body behaves differently ? Some body jitter ... in what way, under what circumstances ?North-Pole
After the collision, There is an object sandwiched between other objects, has been rotating, will not stop. There is an object in another object surface, has been shaking, trigger beginContact and endContact non-stop. FPS always 60. I use libgdx ,language is java, It takes the way of the JNI call native methods.AC123

1 Answers

1
votes

If I get it right you get two bodies colliding and on the collision the body A penetrates body b sticking to it and that causes odd behaviour ? Assuming that I understood right what you are saying then the problem is quite common. It happens often between dynamic bodies. The solution for that is to set the main body as a bullet. That will turn CCD, Continuos Collision Detection, which is expensive in a way as it will perform collision detection on the body constantly every frame and not only when the body AABB's overlap with some other body. Only set this on the bodies that you think need it, so for instance if you are doing golf game you would only set it on the golf ball.