body SetMassFromShapes()

Hello from Perú!
I want to create a compound body in box2dWeb, what i need is a maze, this maze can rotate using keyboard. I saw an example of compound bodies in AS3 but i can not find this function: body.SetMassFromShapes().
This is may code:

Code: Select all

....
for (var j=0; j<9; j++) {
         for (var i=0; i<9; i++) {
            if (maze[j][i]==1) {
               console.log("pos i="+i+" j="+j);
               var boxDef = new b2FixtureDef();
               boxDef.density=1.0;
               boxDef.friction=0.5;
               boxDef.restitution=0.2;
               boxDef.shape = new b2PolygonShape();
               boxDef.shape.SetAsOrientedBox(1.5,1.5,new b2Vec2(i, j), 0);
               body.CreateFixture(boxDef);
               
            }
         }
      }
      console.log(body);
      body.SetMassFromShapes();// ERROR

Can someone help me?
Sorry by my english 😛
I think SetMassFromShapes is from the older version of Box2D. It should be ok with just CreateFixture... are you seeing some problem?
Thansk for reply.
The problem is that i can not see the compound body, i only see one box.
Image
Console for body:
m_I: 1966815.9
m_angularDamping: 0
m_angularVelocity: -5.98947528548628e-18
m_contactList: Ia
m_controllerCount: 0
m_controllerList: null
m_fixtureCount: 50
m_fixtureList: ba
m_flags: 38
m_force: r
m_inertiaScale: 1
m_invI: 5.084359954584463e-7
m_invMass: 0.000045351473922902495
well, SetMassFromShapes is from the older version of Box2DFlash and in box2DFlash 2.1a does not work but it is not necessary.
I had to change my code to box2DFlash 2.1a and works perfectly 😀 .
But the same code in Box2DWeb does not work, very strange. 🙁
You can see the topic http://box2d.org/forum/viewtopic.php?f=9&t=7699

Greetings from Peru

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