Polygon shapes collisions not handled properly

Hello!

I'd like to report a bug (I think it is one) which I encountered with circular, convex polygon shapes with an edge count higher than four.

Here is a screenshot showing the problem in section B:
Image

The testing options were:

  • Fixed timestep of 1/60
  • 10 velocity, position iterations
  • In the image section A: Bodies with polygon shapes with edge counts in the range of 3-4
  • In the image section B: Bodies with polygon shapes with edge counts in the range of 3-7

I tried the following:

  • Different step size / iteration variations
  • Different physics world scales (in the size suggested by the manual)
  • If the polygons were arranged in the right direction (CCW/ CW)
  • Same mass for all bodies
  • Different spawn positions and velocities

All different tests lead to the same overlapping problem as seen in section B

My questions:

  • If I might be doing something wrong here, what could it be?
  • Is this a known problem?
  • I have encountered the seen overlapping problem with other polygon shapes too - mainly with triangulated complex images. Sometimes, even at low speeds, polygons don't seem to collide properly

Thanks for reading and best regards,
Hero
I'm not seeing this problem at all. Here is a screen shot from the PolyShapes test.

Attachment:
Polygons.png
Polygons.png [ 12.39 KiB | Viewed 956 times ]


Can you reproduce this problem in the testbed?
Thanks for your reply,

I'll try to reproduce it and check if there are any differences to my test right away
Hello once more,

I have found and fixed the bug, which apparently was located not in Box2D (how did I dare to accuse it of that! xD) but in my code.

In case somebody else encounters the same problem, here is what happened:

In some cases (edge count over 5), the loop which would compute the vertices for the polygons would cause the last vertex equal the first one. That means one segment of the polygon would have a length of zero. There apparently is an assertion in Box2D, too, which can detect this, but dumb as I am I didn't use the debug build for testing!

Thanks for your help again!

Original thread: https://box2d.org/forum/viewtopic.php?t=7540