Compound Shapes - Bizarre Motion

In this demo, I'm creating circular shapes in box2D, composed of 14 triangles each, grouped into compound shapes...

http://studio.barliesque.com/temp/Compound.swf

...the balls bounce extremely oddly, sort of easing into place before bouncing back. Sometimes they'll even overlap!

The mass of each compound shape is set automatically with SetMassFromShapes() and yet they seem to behave as if they're center of gravity is off balance. They also behave more light-weight than a single circle shape occupying the same area, and with the same density.

For comparison sake, see the same demo this time using b2CircleDef instead...

http://studio.barliesque.com/temp/NotCompound.swf

Obviously for the sake of this example, circles are the way to go--I'm just working on handling convex hulls in general. By all rights, these two demos should work almost identically--aside from the fact that the compound shapes have flat-faceted sides, not smooth curves like the circle.

Any ideas?
Did you remember to define the vertices of your triangles in a Clockwise order? You'll definitely get weirdness like what you're seeing if they're defined the other way.
They need to be in counter-clockwise order, according to the docs. I had it wrong at first and mass was computed in the negative, which isn't happening now.

Here's a breakdown of one of the circular shapes:

Triangle: ((x=-31, y=0))-((x=-28, y=12))-((x=-22, y=22))
Triangle: ((x=-31, y=0))-((x=-22, y=22))-((x=-12, y=28))
Triangle: ((x=-31, y=0))-((x=-12, y=28))-((x=0, y=31))
Triangle: ((x=-31, y=0))-((x=0, y=31))-((x=12, y=28))
Triangle: ((x=-31, y=0))-((x=12, y=28))-((x=22, y=22))
Triangle: ((x=-31, y=0))-((x=22, y=22))-((x=28, y=12))
Triangle: ((x=-31, y=0))-((x=28, y=12))-((x=31, y=0))
Triangle: ((x=-31, y=0))-((x=31, y=0))-((x=28, y=-12))
Triangle: ((x=-31, y=0))-((x=28, y=-12))-((x=22, y=-22))
Triangle: ((x=-31, y=0))-((x=22, y=-22))-((x=12, y=-28))
Triangle: ((x=-31, y=0))-((x=12, y=-28))-((x=0, y=-31))
Triangle: ((x=-31, y=0))-((x=0, y=-31))-((x=-12, y=-28))
Triangle: ((x=-31, y=0))-((x=-12, y=-28))-((x=-22, y=-22))
Triangle: ((x=-31, y=0))-((x=-22, y=-22))-((x=-28, y=-12))
Note: These coordinate positions are multiplied by a meters-per-pixel ratio.
Mass = 0.11312500000000003
Quote:
Note: These coordinate positions are multiplied by a meters-per-pixel ratio.

...and the Y-axis is inverted! 😆 ...which does result in counter-clockwise triangles.
Hmm, I think you've got some problem with slowdown. Are you decoupling the physics from the framerate properly?
Yes, I calculate the physics timestep based on what the actual framerate is. That's the case with both Compound.swf and NotCompound.swf
In all the various tests I've run, the framerate has been all over the map, but physics maintains a consistent speed.

This strange behavior lessens the fewer triangles I add to the compound shape.

I also notice now that the paddles become sluggish as well, despite the framerate holding around 40fps.
I've been able to greatly reduce these weird issues simply by creating the convex shape with as few polygons as possible--so, not with triangles. I was really hoping there might be a solution to the issue, because even circles constructed from 3 polygons (instead of 14 triangles) still show faint signs of the same problems. 🙁

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