Box2D销毁主体原因:无法写入core-dump-core-dumps-have-disabled

时间:2017-06-02 07:46:22

标签: java android-studio libgdx box2d physics-engine

我最近一直在使用libgdx box2d物理引擎,我正在制作移动的物体,我需要在它们离屏后消灭这些物体。所以,当我摧毁他们时,我得到了这个错误:

  

失败到写入核心转储核 - 转储具备的,被禁用

我试过的解决方案:

  

ulimit -c unlimited(在终端中)

我在Mac上,我正在使用android 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 个答案:

没有答案