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


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.setPhysics(0.0, 0.5, 0.5);


Edit: Solved…