Closed 467598557 closed 6 years ago
for(var i = this._deleteBodies.length - 1;i >= 0;i --){ var body = this._deleteBodies[i]; var shapeList = body.shapeList; for(var j = shapeList.length - 1;j >= 0;j --){ space.removeShape(shapeList[j]); } if(!body.isStatic()) { space.removeBody(body); } } this._deleteBodies.length = 0;
if(!body.isStatic()) { space.removeBody(body); } 在从物理世界中解绑一个view,会尝试从space中删除body,然而,静态view并不会添加到space中的bodies数组中,进而引发assert抛出异常,不影响流程,但是持续报错,第二段代码中的判断是我自己添加的,运行之后就不会持续assert了,不知是否符合正确的逻辑
if(!body.isStatic()) { space.removeBody(body); }
感谢,已修复
for(var i = this._deleteBodies.length - 1;i >= 0;i --){ var body = this._deleteBodies[i]; var shapeList = body.shapeList; for(var j = shapeList.length - 1;j >= 0;j --){ space.removeShape(shapeList[j]); } if(!body.isStatic()) { space.removeBody(body); } } this._deleteBodies.length = 0;
if(!body.isStatic()) { space.removeBody(body); }
在从物理世界中解绑一个view,会尝试从space中删除body,然而,静态view并不会添加到space中的bodies数组中,进而引发assert抛出异常,不影响流程,但是持续报错,第二段代码中的判断是我自己添加的,运行之后就不会持续assert了,不知是否符合正确的逻辑