Created
January 3, 2013 20:15
-
-
Save szepi1991/4446753 to your computer and use it in GitHub Desktop.
Remove a body from the game in AndEngine. This needs to be done on the updateThread.
Code from: http://www.matim-dev.com/remove-body-completely.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final PhysicsConnector physicsConnector = | |
physicsWorld.getPhysicsConnectorManager().findPhysicsConnectorByShape(shape); | |
mEngine.runOnUpdateThread(new Runnable() | |
{ | |
@Override | |
public void run() | |
{ | |
if (physicsConnector != null) | |
{ | |
physicsWorld.unregisterPhysicsConnector(physicsConnector); | |
body.setActive(false); | |
physicsWorld.destroyBody(bbody); | |
scene.detachChild(shape); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment