java Box2D销毁正文原因:FailedToWriteCoreDumpCoreDumpsShaveBeenDisabled
我最近一直在使用libgdx-box2d物理引擎,我正在制作运动物体,在这些物体离开屏幕后,我需要销毁它们。所以当我销毁它们时,我得到了一个错误:
failed-to-write-core-dump-core-dumps-have-been-disabled
我尝试过的解决方案:
ulimit -c unlimited (in terminal)
我在mac上,我正在使用安卓 studio编写代码。
只有当我销毁尸体时才会发生错误。
循环代码:
public void updateMapGen(float delta, OrthographicCamera cam) {
this.update(delta);
// loop through all the blocks, each block has a box2d body
for (Block b : blocks) {
// check if the body is off camera
if ((b.body.getPosition().x * PPM) + b.getWidth() < cam.position.x - cam.viewportWidth / 2) {
// destroy the body. Error doesnt come at a specific line, but removing this line fixes the error
b.destroy();
blocks.removeValue(b, true);
}
}
// System.out.println("BLOCKS: " + blocks.size);
}
销毁尸体的代码:
public void destroy(){
body.getWorld().destroyBody(body);
}
共 (0) 个答案