LeBlaireau
LeBlaireau

Reputation: 17467

nape removing body from the space

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

Answers (1)

deltaluca
deltaluca

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

Related Questions