我在Box2D使用Libgdx。
当一个特定的身体在地面上坠毁时,我遇到了摧毁关节的问题, 检测到碰撞体,然后我想破坏一些关节。 总是当我这样做时,我得到一个错误。
我还测试了破坏方法进行测试,我得到了同样的错误。 在world.step(...)之后它被称为正确吗?
我读到关于在时间步之间销毁关节时发生错误的事情, 但我怎么能在世界之外做到这一点。步骤?
我正在使用R.U.B.E.对于Box2d来说。
这是一些代码即时测试:
scene.world.step(1.0f/scene.stepsPerSecond, scene.velocityIterations, scene.positionIterations);
if(!scene.world.isLocked()){ //to check that the joint is no locked
Joint joint1= scene.get(Joint.class, "joint1"); // read the joint from RUBE scene
scene.world.destroyJoint(joint1); //destroy it
}
这是错误:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006559368f, pid=5868, tid=3772
#
# JRE version: 7.0_07-b10
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.3-b01 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [gdx64.dll+0x1368f]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Jake\Downloads\AndroidDevelopment\EclipseDaten\Motor-race-desktop\hs_err_pid5868.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
AL lib: alc_cleanup: 1 device not closed
任何人都可以帮助我吗? :)
答案 0 :(得分:1)
确保你在没有错误的情况下销毁关节的最佳方法是你需要销毁需要销毁的关节,并在world.step()函数之后销毁关节。
例如
world.step(......);
if(jointToDestroy != null) {
world.destroyJoint(jointToDestroy);
jointToDestroy = null;
}
希望它有所帮助。