Skip to content

Instantly share code, notes, and snippets.

@szepi1991
Created January 3, 2013 20:15
Embed
What would you like to do?
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
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