ComputeMass function

Hi guys!
Why ComputeMass returns negative weight and rotational inertia?

Code:
var triangleDef:b2BodyDef;
var triangleShapeDef:b2PolygonShape;
var triangleFixture:b2FixtureDef;
var triangle:b2Body;
      
triangleDef = new b2BodyDef;
      
triangleDef.type = b2Body.b2_dynamicBody;
         
triangleShapeDef = new b2PolygonShape();
triangleShapeDef.SetAsArray(new Array(new b2Vec2(100/30, 50/30),
                        new b2Vec2(200/30, 150/30),
                        new b2Vec2(260/30, 160/30)
                                      ) , 3);
   
triangleFixture = new b2FixtureDef;
triangleFixture.shape = triangleShapeDef;
         
triangle = myworld.CreateBody(triangleDef);
triangle.CreateFixture(triangleFixture);
      
var Mass:b2MassData = new b2MassData();
triangleShapeDef.ComputeMass(Mass, 0.5);
         
         trace(Mass.I);
         trace(Mass.mass);
         trace(Mass.center.x);
         trace(Mass.center.y);

output:
-78.62654320987647
-1.3888888888888875
6.222222222222221
4
The order you have given the vertices in makes the polygon winding clockwise. Box2D expects it to be counter-clockwise, so you'll need to reverse the order.
Thank you, man!

I have one more problem.
I created one wall:

Code:
 var walls:b2Body;
         var wallsDef:b2BodyDef;
         var wallsShapeDef:b2PolygonShape;
         var wallsFixture:b2FixtureDef = new b2FixtureDef;
         
         wallsDef = new b2BodyDef();
         wallsDef.type = b2Body.b2_staticBody;
         
         wallsShapeDef = new b2PolygonShape();
         wallsShapeDef.SetAsArray(new Array( new b2Vec2(30/30, 30/30),
                             new b2Vec2(30/30, 600/30),
                             new b2Vec2(40/30, 600/30),
                             new b2Vec2(40/30, 30/30)
                                    ) , 4);
         
         walls = myworld.CreateBody(wallsDef);
         
wallsFixture.friction = 0.5;
         wallsFixture.restitution = 0.5;

         wallsFixture.shape = wallsShapeDef;
         walls.CreateFixture(wallsFixture);


Other bodies collide each other correctly, but ignore wall(pass through).
Why?
For the same reason 🙂 You need to give the vertices in counter-clockwise order.
(30/30, 30/30),(30/30, 600/30),(40/30, 600/30),(40/30, 30/30)

It's counter-clockwise, isnt it?
Nope 😛

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