ofBox2d: Assertion failed: (m_bodyCount > 0), function DestroyBody

#1

Hi! I’m drawing a lot of polylines and then I want to add them to the 2d world just like the box2d example. I’ve made a vector called “vector ofxBox2dEdge edgeLine” where I try to add my regular polylines to ofxBox2dEdge.

But it doesnt work. It stops with the error:

Assertion failed: (m_bodyCount > 0), function DestroyBody,

This is how I do it. Is it totally wrong? Basically copied the contours example

for(float i = 0; i < polylines.size(); i++){
        ofxBox2dEdge edge;
        edge.addVertexes(polylines[i]);
        edge.setPhysics(0.0, 0.5, 0.5);
        edgeLine.push_back(edge);
        edgeLine.back().create(box2d.getWorld());
    }

Thanks!

Edit: Solved…