Bizarre erratic compound shape body behavior

Hi, I'm developing a 2D platforming video game with JBox2D. I'd like my sprite to have a center of mass down towards the feet, so she keeps balanced even on slight slopes. I was delighted to learn that JBox2D supported compound shapes, and I decided to experiment with a shape like this:
Code:
   _
  | |
__| |__
-------
This would be two rectangles, one horizontally oriented and one vertically popping out from the top of the horizontal one. Also, the bottom one would have much more mass than the top one, maybe 10 or 100 times more.

So I tried doing this with the following code, taken right out of the CompoundShapes demo:

Code:
        PolygonDef sd1 = new PolygonDef();
        sd1.setAsBox(0.25f, 0.5f, new Vec2(0.0f, 0f), 0);
        sd1.density = 0.1f;

        PolygonDef sd2 = new PolygonDef();;
        sd2.setAsBox(0.5f, 0.25f, new Vec2(0.0f, -1f), 0);
        sd2.density = 200f;
        myShapes.add(body.createShape(sd1));
        myShapes.add(body.createShape(sd2));

        body.setMassFromShapes();


And what happens is:

Imagehttp://www.youtube.com/watch_private?v=KMwX-eFer3E&sharing_token=d1vV3j91ZOEnBB7BP2amhQ

It seems like an issue with improper calculation of center of mass, but getLocalCenter returns the right center of mass - the same value returned in the CompoundShapes demo.

What's maddening is that the CompoundShapes demo works great, running from the same project linking with the same JBox2D code. In the demo I can change densities, rotations, positions, whatever - and it still works. I've tried paring my project down so the only object in the World is this body. And it still breaks in exactly the same way!

HELP!

NOTE: I am using JBox2D SVN, checked out a week or so ago.
I can't see the video (I have to have an account?!!?!) but IMHO are you sure to paint your object in the right place 🙄 ? and do you use the right method to get the body position "Body.getWorldCenter()"?
Yes unfortunately the polygon is being drawn at the right spot, and within a few frames the BoundaryListener is called because the object flies offscreen. Sorry you need an account to watch the video...I'd rather not put it on my public youtube page...
i actually have no idea why that is happening. um.... did you try messing with the gravity and lowering the densities? Very weird...

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