Skip to content

Commit

Permalink
clean up ground bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Vanderlin committed Nov 19, 2013
1 parent 2ca6094 commit 8390299
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ofxBox2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ void ofxBox2d::createGround(float x1, float y1, float x2, float y2) {
return;
}

if(ground!=NULL) world->DestroyBody(ground);

b2BodyDef bd;
ground = world->CreateBody(&bd);

Expand All @@ -355,7 +357,8 @@ void ofxBox2d::createBounds(float x, float y, float w, float h) {
ofLog(OF_LOG_WARNING, "ofxBox2d:: - Need a world, call init first! -");
return;
}

if(ground!=NULL) world->DestroyBody(ground);

b2BodyDef bd;
bd.position.Set(0, 0);
ground = world->CreateBody(&bd);
Expand Down

0 comments on commit 8390299

Please sign in to comment.