Reputation: 17467
When I sue the following code the body graphic is removed, however in debug mode I can still see the outline of the body which would suggest the body still exists. How do I totally remove this body?
private function updateGraphics(b:Body) {
if (b.position.y > 360) {
play.removeChild(b.userData.graphic);
}
}
Upvotes: 0
Views: 1206
Reputation: 1652
Nape has nothing to do with graphics. A Body is not magically tied to the way you display it on the screen, so removing a flash displayObject from a display list cannot possibly remove the nape body from the space.
The answer, is to remove it from the nape space!
body.space = null;
is the simplest way.
Upvotes: 2