Hello everyone.
I've encountered weird bug in JBox2D? used in my game closely related to circle-polygon collision detection and solving.
I have one heavy body with rectangle polygon shape and many light bodies witch circle shapes in my simulation. The heavy body is moving while the circle bodies are stationary (but still dynamic). Most of the time the collisions and their solving seems to be fine but time from time the solution of the collision is completely wrong: the heavy body is thrown away from light body and unrealistically rotated despide the mass difference. Another weird behavior is that if the heavy body is moving quite fast and it collides with row of few small light bodies from side, it is bounced from them like they were solid obstacle instead of throwing light bodies away. This happens every time (not just sometimes as the first issue) so it may be caused by something else.
I've tried to experiment with their mass ratio, enabling bullets, different fixuture properties, etc. but the only solution is to change circle shape of small bodies to square polygon shape. This solves both issues completely!
Do you have any clue what may be wrong with circle-poygon collision detection and solving?
I've tried to debug the issue by pritnting out the impulses and normals of collisions in postSolve() but as I understand Box2D, the impulses and their normals were quite fine except that some calls of postSolve had [0.0, 0.0] in ContactImpulse.normalImpulses but those values are appearing in collisions that are resolved fine too.
Do you have any idea what I can do to investigate the problem further?
It may be important to note that I'm using PlayN fork of the JBox2D if it is relevant.
I've encountered weird bug in JBox2D? used in my game closely related to circle-polygon collision detection and solving.
I have one heavy body with rectangle polygon shape and many light bodies witch circle shapes in my simulation. The heavy body is moving while the circle bodies are stationary (but still dynamic). Most of the time the collisions and their solving seems to be fine but time from time the solution of the collision is completely wrong: the heavy body is thrown away from light body and unrealistically rotated despide the mass difference. Another weird behavior is that if the heavy body is moving quite fast and it collides with row of few small light bodies from side, it is bounced from them like they were solid obstacle instead of throwing light bodies away. This happens every time (not just sometimes as the first issue) so it may be caused by something else.
I've tried to experiment with their mass ratio, enabling bullets, different fixuture properties, etc. but the only solution is to change circle shape of small bodies to square polygon shape. This solves both issues completely!
Do you have any clue what may be wrong with circle-poygon collision detection and solving?
I've tried to debug the issue by pritnting out the impulses and normals of collisions in postSolve() but as I understand Box2D, the impulses and their normals were quite fine except that some calls of postSolve had [0.0, 0.0] in ContactImpulse.normalImpulses but those values are appearing in collisions that are resolved fine too.
Do you have any idea what I can do to investigate the problem further?
It may be important to note that I'm using PlayN fork of the JBox2D if it is relevant.