Create Box2D bodies with TMX Objects layer! Cocos2d-x 3.0

Thanks for this thread, it saves me tons of time >:D<

But I suggest you change method createPolyline() as below:

b2Vec2 vertices[30];

→

int verticesCapacity=32;
b2Vec2* vertices = (b2Vec2*)calloc(verticesCapacity, sizeof(b2Vec2));

and

for(Value point : pointsVector) {
CCLOG(“Initializing vector at index: %d”, vindex);

→

for(Value point : pointsVector) {
CCLOG(“Initializing vector at index: %d”, vindex);
if(vindex>=verticesCapacity)
{
verticesCapacity+=32;
vertices = (b2Vec2*)realloc(vertices, verticesCapacity*sizeof(b2Vec2));
}

so that you can use polylines which have more than 30 vertices (with origin method app will crash in this case).