Skip to content

Instantly share code, notes, and snippets.

@housemeow
Created December 6, 2013 12:14
Show Gist options
  • Select an option

  • Save housemeow/7822804 to your computer and use it in GitHub Desktop.

Select an option

Save housemeow/7822804 to your computer and use it in GitHub Desktop.
private void sweepDeadBodies() {
Array<Body> bodies = new Array<Body>();
world.getBodies(bodies);
for (Body body : bodies) {
if (body != null) {
BodyData bodyData = (BodyData) body.getUserData();
if (bodyData.isDead()) {
body.setUserData(null);
world.destroyBody(body);
body = null;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment