销毁灯具时出现LibGDX Java致命错误

时间:2015-06-26 21:11:39

标签: java libgdx

我正在制作基于体素的游戏,我遇到了问题。 我有一个Body,其中包含64个Fixtures,每个夹具都是一个块在我的游戏中。当我尝试删除其中一个灯具时,我有一个java致命错误

这是此错误

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000066bdf3fe, pid=5632, tid=8388
#
# JRE version: Java(TM) SE Runtime Environment (8.0_45-b14) (build 1.8.0_45-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [gdx-box2d64.dll+0x1f3fe]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x000000001955f000):  JavaThread "LWJGL Application" [_thread_in_native, id=8388, stack(0x000000001a190000,0x000000001a290000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x0000000000000010

Registers:
RAX=0x000000001a390080, RBX=0x000000001a390080, RCX=0x000000001a3bcca0, RDX=0x0000000000000000
RSP=0x000000001a28f150, RBP=0x000000001a28f2a8, RSI=0x0000000000000000, RDI=0x000000001a3bcca0
R8 =0x000000001a390080, R9 =0x000000001a3bcca0, R10=0x0000000002645e08, R11=0x000000005c997ca0
R12=0x0000000000000000, R13=0x0000000016d733c0, R14=0x000000001a28f2f8, R15=0x000000001955f000
RIP=0x0000000066bdf3fe, EFLAGS=0x0000000000010246

Top of Stack: (sp=0x000000001a28f150)
0x000000001a28f150:   0000000016d733c0 0000000000000000
0x000000001a28f160:   000000001955f000 0000000019564cf0
0x000000001a28f170:   000000001a390080 000000001a3bcca0
0x000000001a28f180:   0000000002637ced 0000000066be8702
0x000000001a28f190:   000000001a28f798 0000000017193a40
0x000000001a28f1a0:   00000000000003d8 0000000017193a50
0x000000001a28f1b0:   0000000066c1c830 000000001955f1f8
0x000000001a28f1c0:   000000001a28f2f8 000000001955f000
0x000000001a28f1d0:   0000000066c1c8b0 000000001955f1f8
0x000000001a28f1e0:   000000001a28f2f8 000000001955f000
0x000000001a28f1f0:   0000000016d733c0 0000000016d733c0
0x000000001a28f200:   0000000000000020 0000000002645e34
0x000000001a28f210:   000000001a28f798 000000001a28f2a8
0x000000001a28f220:   0000000000000020 0000000002637ced
0x000000001a28f230:   0000000000000000 0000000002645bab
0x000000001a28f240:   000000001955f000 0000000016d733c0 

Instructions: (pc=0x0000000066bdf3fe)
0x0000000066bdf3de:   40 00 57 56 53 48 83 ec 20 48 8b 41 58 48 89 cf
0x0000000066bdf3ee:   48 89 d6 f6 80 98 92 01 00 02 0f 85 f2 00 00 00
0x0000000066bdf3fe:   48 39 7e 10 74 19 48 8d 15 55 8b 03 00 48 8d 0d
0x0000000066bdf40e:   d5 8c 03 00 41 b8 de 00 00 00 e8 53 4c 01 00 8b 


Register to memory mapping:

RAX=0x000000001a390080 is an unknown value
RBX=0x000000001a390080 is an unknown value
RCX=0x000000001a3bcca0 is an unknown value
RDX=0x0000000000000000 is an unknown value
RSP=0x000000001a28f150 is pointing into the stack for thread: 0x000000001955f000
RBP=0x000000001a28f2a8 is pointing into the stack for thread: 0x000000001955f000
RSI=0x0000000000000000 is an unknown value
RDI=0x000000001a3bcca0 is an unknown value
R8 =0x000000001a390080 is an unknown value
R9 =0x000000001a3bcca0 is an unknown value
R10=0x0000000002645e08 is at code_begin+840 in an Interpreter codelet
method entry point (kind = native)  [0x0000000002645ac0, 0x0000000002646420]  2400 bytes
R11=0x000000005c997ca0 is an unknown value
R12=0x0000000000000000 is an unknown value
R13={method} {0x0000000016d733c8} 'jniDestroyFixture' '(JJJ)V' in 'com/badlogic/gdx/physics/box2d/World'
R14=0x000000001a28f2f8 is pointing into the stack for thread: 0x000000001955f000
R15=0x000000001955f000 is a thread


Stack: [0x000000001a190000,0x000000001a290000],  sp=0x000000001a28f150,  free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [gdx-box2d64.dll+0x1f3fe]
C  [gdx-box2d64.dll+0x28702]
C  0x0000000002645e34

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.badlogic.gdx.physics.box2d.World.jniDestroyFixture(JJJ)V+0
j  com.badlogic.gdx.physics.box2d.World.destroyFixture(Lcom/badlogic/gdx/physics/box2d/Body;Lcom/badlogic/gdx/physics/box2d/Fixture;)V+13
j  com.badlogic.gdx.physics.box2d.Body.destroyFixture(Lcom/badlogic/gdx/physics/box2d/Fixture;)V+6
j  blocks.Part.close()V+22
j  ingens.Ingens.create()V+250
j  com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop()V+29
j  com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run()V+27
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x00000000023ae000 JavaThread "DestroyJavaVM" [_thread_blocked, id=9792, stack(0x0000000002430000,0x0000000002530000)]
=>0x000000001955f000 JavaThread "LWJGL Application" [_thread_in_native, id=8388, stack(0x000000001a190000,0x000000001a290000)]
  0x00000000171de800 JavaThread "Service Thread" daemon [_thread_blocked, id=2948, stack(0x0000000018de0000,0x0000000018ee0000)]
  0x0000000017195000 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=5456, stack(0x00000000188e0000,0x00000000189e0000)]
  0x0000000017184800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=6792, stack(0x00000000187e0000,0x00000000188e0000)]
  0x000000001717d800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=10096, stack(0x00000000186e0000,0x00000000187e0000)]
  0x000000001717b800 JavaThread "Attach Listener" daemon [_thread_blocked, id=4304, stack(0x00000000185e0000,0x00000000186e0000)]
  0x0000000017186800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=6228, stack(0x00000000184e0000,0x00000000185e0000)]
  0x0000000002627000 JavaThread "Finalizer" daemon [_thread_blocked, id=9460, stack(0x00000000183e0000,0x00000000184e0000)]
  0x000000000261e000 JavaThread "Reference Handler" daemon [_thread_blocked, id=1020, stack(0x00000000182e0000,0x00000000183e0000)]

Other Threads:
  0x0000000017147800 VMThread [stack: 0x00000000181e0000,0x00000000182e0000] [id=5568]
  0x0000000018a20000 WatcherThread [stack: 0x0000000018ee0000,0x0000000018fe0000] [id=7472]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap:
 PSYoungGen      total 38400K, used 12899K [0x00000000d5d80000, 0x00000000d8800000, 0x0000000100000000)
  eden space 33280K, 38% used [0x00000000d5d80000,0x00000000d6a18df0,0x00000000d7e00000)
  from space 5120K, 0% used [0x00000000d8300000,0x00000000d8300000,0x00000000d8800000)
  to   space 5120K, 0% used [0x00000000d7e00000,0x00000000d7e00000,0x00000000d8300000)
 ParOldGen       total 87552K, used 0K [0x0000000081800000, 0x0000000086d80000, 0x00000000d5d80000)
  object space 87552K, 0% used [0x0000000081800000,0x0000000081800000,0x0000000086d80000)
 Metaspace       used 7284K, capacity 7421K, committed 7680K, reserved 1056768K
  class space    used 723K, capacity 754K, committed 768K, reserved 1048576K

Card table byte_map: [0x00000000119f0000,0x0000000011df0000] byte_map_base: 0x00000000115e4000

Marking Bits: (ParMarkBitMap*) 0x000000005cf74040
 Begin Bits: [0x00000000124a0000, 0x0000000014440000)
 End Bits:   [0x0000000014440000, 0x00000000163e0000)

Polling page: 0x0000000002370000

CodeCache: size=245760Kb used=2131Kb max_used=2143Kb free=243628Kb
 bounds [0x0000000002630000, 0x00000000028a0000, 0x0000000011630000]
 total_blobs=917 nmethods=423 adapters=407
 compilation: enabled

Compilation events (10 events):
Event: 0.564 Thread 0x0000000017195000 nmethod 417 0x0000000002840290 code [0x0000000002840460, 0x0000000002840c58]
Event: 0.564 Thread 0x0000000017195000  418       3       java.util.zip.InflaterInputStream::close (34 bytes)
Event: 0.564 Thread 0x0000000017195000 nmethod 418 0x000000000283fd10 code [0x000000000283fe80, 0x0000000002840178]
Event: 0.566 Thread 0x0000000017195000  420       3       com.badlogic.gdx.utils.LongMap::hash2 (22 bytes)
Event: 0.566 Thread 0x0000000017195000 nmethod 420 0x0000000002844510 code [0x0000000002844660, 0x00000000028447f0]
Event: 0.566 Thread 0x0000000017195000  422       3       com.badlogic.gdx.utils.LongMap::hash3 (22 bytes)
Event: 0.566 Thread 0x0000000017195000 nmethod 422 0x0000000002844890 code [0x00000000028449e0, 0x0000000002844b70]
Event: 0.566 Thread 0x0000000017195000  421       3       com.badlogic.gdx.utils.Array::add (48 bytes)
Event: 0.566 Thread 0x0000000017195000 nmethod 421 0x0000000002844c10 code [0x0000000002844dc0, 0x00000000028451e8]
Event: 0.567 Thread 0x0000000017184800  423       4       java.lang.StringBuilder::append (8 bytes)

GC Heap History (0 events):
No events

Deoptimization events (0 events):
No events

Internal exceptions (10 events):
Event: 0.130 Thread 0x00000000023ae000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d60a42c0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u45\3457\hotspot\src\share\vm\prims\jvm.cpp, line 1382]
Event: 0.130 Thread 0x00000000023ae000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d60a4478) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u45\3457\hotspot\src\share\vm\prims\jvm.cpp, line 1382]
Event: 0.131 Thread 0x00000000023ae000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d60a7f70) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u45\3457\hotspot\src\share\vm\prims\jvm.cpp, line 1382]
Event: 0.131 Thread 0x00000000023ae000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d60a8128) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u45\3457\hotspot\src\share\vm\prims\jvm.cpp, line 1382]
Event: 0.236 Thread 0x00000000023ae000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d61a55e0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u45\3457\hotspot\src\share\vm\prims\jvm.cpp, line 1382]
Event: 0.236 Thread 0x00000000023ae000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d61a7208) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u45\3457\hotspot\src\share\vm\prims\jvm.cpp, line 1382]
Event: 0.236 Thread 0x00000000023ae000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d61a82c8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u45\3457\hotspot\src\share\vm\prims\jvm.cpp, line 1382]
Event: 0.236 Thread 0x00000000023ae000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d61ad2c0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u45\3457\hotspot\src\share\vm\prims\jvm.cpp, line 1382]
Event: 0.236 Thread 0x00000000023ae000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d61ade68) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u45\3457\hotspot\src\share\vm\prims\jvm.cpp, line 1382]
Event: 0.236 Thread 0x00000000023ae000 Exception <a 'java/security/PrivilegedActionException'> (0x00000000d61ae9e0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u45\3457\hotspot\src\share\vm\prims\jvm.cpp, line 1382]

Events (10 events):
Event: 0.563 loading class com/badlogic/gdx/physics/box2d/CircleShape
Event: 0.563 loading class com/badlogic/gdx/physics/box2d/CircleShape done
Event: 0.563 loading class com/badlogic/gdx/physics/box2d/EdgeShape
Event: 0.563 loading class com/badlogic/gdx/physics/box2d/EdgeShape done
Event: 0.565 loading class com/badlogic/gdx/physics/box2d/ChainShape
Event: 0.565 loading class com/badlogic/gdx/physics/box2d/ChainShape done
Event: 0.565 loading class blocks/BlockType
Event: 0.565 loading class blocks/BlockType done
Event: 0.566 loading class java/io/PrintWriter
Event: 0.566 loading class java/io/PrintWriter done


Dynamic libraries:
0x00007ff7c6380000 - 0x00007ff7c63b7000     C:\Program Files\Java\jre1.8.0_45\bin\javaw.exe
0x00007ffc789e0000 - 0x00007ffc78b8c000     C:\Windows\SYSTEM32\ntdll.dll
0x00007ffc78420000 - 0x00007ffc7855e000     C:\Windows\system32\KERNEL32.DLL
0x00007ffc75d00000 - 0x00007ffc75e15000     C:\Windows\system32\KERNELBASE.dll
0x00007ffc746d0000 - 0x00007ffc7475e000     C:\Windows\system32\apphelp.dll
0x00007ffc61710000 - 0x00007ffc61763000     C:\Windows\AppPatch\AppPatch64\AcGenral.DLL
0x00007ffc76410000 - 0x00007ffc764ba000     C:\Windows\system32\msvcrt.dll
0x00007ffc75900000 - 0x00007ffc7592e000     C:\Windows\SYSTEM32\SspiCli.dll
0x00007ffc78160000 - 0x00007ffc781b4000     C:\Windows\system32\SHLWAPI.dll
0x00007ffc78860000 - 0x00007ffc789d7000     C:\Windows\system32\USER32.dll
0x00007ffc77b40000 - 0x00007ffc77cd4000     C:\Windows\system32\ole32.dll
0x00007ffc76520000 - 0x00007ffc77a38000     C:\Windows\system32\SHELL32.dll
0x00007ffc75130000 - 0x00007ffc75151000     C:\Windows\SYSTEM32\USERENV.dll
0x00007ffc78370000 - 0x00007ffc7841a000     C:\Windows\system32\ADVAPI32.dll
0x00007ffc6ee10000 - 0x00007ffc6ee2e000     C:\Windows\SYSTEM32\MPR.dll
0x00007ffc78570000 - 0x00007ffc786b1000     C:\Windows\system32\RPCRT4.dll
0x00007ffc764c0000 - 0x00007ffc76519000     C:\Windows\SYSTEM32\sechost.dll
0x00007ffc77dc0000 - 0x00007ffc77fd1000     C:\Windows\SYSTEM32\combase.dll
0x00007ffc76060000 - 0x00007ffc761b1000     C:\Windows\system32\GDI32.dll
0x00007ffc75b30000 - 0x00007ffc75b45000     C:\Windows\SYSTEM32\profapi.dll
0x00007ffc740e0000 - 0x00007ffc74192000     C:\Windows\SYSTEM32\SHCORE.dll
0x00007ffc77a40000 - 0x00007ffc77a76000     C:\Windows\system32\IMM32.DLL
0x00007ffc78000000 - 0x00007ffc78152000     C:\Windows\system32\MSCTF.dll
0x00007ffc73c00000 - 0x00007ffc73e7a000     C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.17810_none_6240b9c7ecbd0bda\COMCTL32.dll
0x000000005d5b0000 - 0x000000005d682000     C:\Program Files\Java\jre1.8.0_45\bin\msvcr100.dll
0x000000005c770000 - 0x000000005cff3000     C:\Program Files\Java\jre1.8.0_45\bin\server\jvm.dll
0x00007ffc6e720000 - 0x00007ffc6e729000     C:\Windows\SYSTEM32\WSOCK32.dll
0x00007ffc73280000 - 0x00007ffc732a2000     C:\Windows\SYSTEM32\WINMM.dll
0x00007ffc732b0000 - 0x00007ffc732ba000     C:\Windows\SYSTEM32\VERSION.dll
0x00007ffc77ce0000 - 0x00007ffc77ce7000     C:\Windows\system32\PSAPI.DLL
0x00007ffc786d0000 - 0x00007ffc7872a000     C:\Windows\system32\WS2_32.dll
0x00007ffc72fa0000 - 0x00007ffc72fca000     C:\Windows\SYSTEM32\WINMMBASE.dll
0x00007ffc786c0000 - 0x00007ffc786c9000     C:\Windows\system32\NSI.dll
0x00007ffc75cb0000 - 0x00007ffc75cff000     C:\Windows\SYSTEM32\cfgmgr32.dll
0x00007ffc74930000 - 0x00007ffc74958000     C:\Windows\SYSTEM32\DEVOBJ.dll
0x000000005e4a0000 - 0x000000005e4af000     C:\Program Files\Java\jre1.8.0_45\bin\verify.dll
0x000000005d580000 - 0x000000005d5a9000     C:\Program Files\Java\jre1.8.0_45\bin\java.dll
0x000000005e480000 - 0x000000005e496000     C:\Program Files\Java\jre1.8.0_45\bin\zip.dll
0x0000000065580000 - 0x0000000065616000     C:\Users\Jakub\AppData\Local\Temp\libgdxJakub\88a71714\gdx64.dll
0x00007ffc75240000 - 0x00007ffc75260000     C:\Windows\SYSTEM32\CRYPTSP.dll
0x00007ffc74f80000 - 0x00007ffc74fb6000     C:\Windows\system32\rsaenh.dll
0x00007ffc755f0000 - 0x00007ffc75616000     C:\Windows\SYSTEM32\bcrypt.dll
0x00007ffc75930000 - 0x00007ffc75993000     C:\Windows\system32\bcryptprimitives.dll
0x00007ffc759a0000 - 0x00007ffc759ab000     C:\Windows\SYSTEM32\CRYPTBASE.dll
0x000000005d560000 - 0x000000005d57a000     C:\Program Files\Java\jre1.8.0_45\bin\net.dll
0x00007ffc75350000 - 0x00007ffc753a9000     C:\Windows\system32\mswsock.dll
0x00007ffc6e3d0000 - 0x00007ffc6e3fa000     C:\Windows\SYSTEM32\IPHLPAPI.DLL
0x00007ffc6e4c0000 - 0x00007ffc6e4ca000     C:\Windows\SYSTEM32\WINNSI.DLL
0x00007ffc6e410000 - 0x00007ffc6e426000     C:\Windows\SYSTEM32\dhcpcsvc6.DLL
0x00007ffc6e090000 - 0x00007ffc6e0aa000     C:\Windows\SYSTEM32\dhcpcsvc.DLL
0x000000005d540000 - 0x000000005d551000     C:\Program Files\Java\jre1.8.0_45\bin\nio.dll
0x0000000180000000 - 0x0000000180053000     C:\Users\Jakub\AppData\Local\Temp\libgdxJakub\dc0f0009\lwjgl64.dll
0x00007ffc68110000 - 0x00007ffc6823b000     C:\Windows\SYSTEM32\OPENGL32.dll
0x00007ffc737d0000 - 0x00007ffc737fe000     C:\Windows\SYSTEM32\GLU32.dll
0x00007ffc69310000 - 0x00007ffc69408000     C:\Windows\SYSTEM32\DDRAW.dll
0x00007ffc73b50000 - 0x00007ffc73b59000     C:\Windows\SYSTEM32\DCIMAN32.dll
0x00000000192e0000 - 0x0000000019344000     C:\Users\Jakub\AppData\Local\Temp\libgdxJakub\dc0f0009\OpenAL64.dll
0x00007ffc747f0000 - 0x00007ffc747fb000     C:\Windows\SYSTEM32\kernel.appcore.dll
0x00007ffc74800000 - 0x00007ffc74929000     C:\Windows\system32\uxtheme.dll
0x00007ffc787a0000 - 0x00007ffc78856000     C:\Windows\SYSTEM32\clbcatq.dll
0x00007ffc5d270000 - 0x00007ffc5d30d000     C:\Windows\SYSTEM32\dsound.dll
0x00007ffc75ad0000 - 0x00007ffc75b16000     C:\Windows\SYSTEM32\POWRPROF.dll
0x00007ffc731c0000 - 0x00007ffc73230000     C:\Windows\System32\MMDevApi.dll
0x00007ffc6e300000 - 0x00007ffc6e37e000     C:\Windows\SYSTEM32\AUDIOSES.DLL
0x00007ffc77cf0000 - 0x00007ffc77db1000     C:\Windows\system32\OLEAUT32.dll
0x00007ffc73e80000 - 0x00007ffc73ea1000     C:\Windows\system32\dwmapi.dll
0x000000001a490000 - 0x000000001ac60000     C:\Windows\SYSTEM32\ig75icd64.dll
0x00007ffc70260000 - 0x00007ffc706ae000     C:\Windows\SYSTEM32\igdusc64.dll
0x00007ffc735d0000 - 0x00007ffc73662000     C:\Windows\SYSTEM32\mscms.dll
0x00007ffc5c650000 - 0x00007ffc5c691000     C:\Windows\SYSTEM32\icm32.dll
0x0000000066bc0000 - 0x0000000066c7b000     C:\Users\Jakub\AppData\Local\Temp\libgdxJakub\364d8f01\gdx-box2d64.dll
0x00007ffc707b0000 - 0x00007ffc70939000     C:\Windows\SYSTEM32\dbghelp.dll

VM Arguments:
jvm_args: -Dfile.encoding=Cp1250 
java_command: ingens.desktop.DesktopLauncher
java_class_path (initial): D:\Ingens2\desktop\bin;D:\Ingens2\core\bin;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx\1.6.2\b70b1eb9da71076aa47ac8932b42358b00db84a0\gdx-1.6.2.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-box2d\1.6.2\b4406b97b35d7caf7111400ceebc8b92c8998168\gdx-box2d-1.6.2.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-backend-lwjgl\1.6.2\2f75f0807864ffc2f7cbf25a6e43543ce63d21a5\gdx-backend-lwjgl-1.6.2.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-platform\1.6.2\c3f948f4394338a5411b1f6f2791a608a9a42286\gdx-platform-1.6.2-natives-desktop.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-box2d-platform\1.6.2\47ac6e45b6994f6a2b15e42fd567cece6c7bec7c\gdx-box2d-platform-1.6.2-natives-desktop.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\org.lwjgl.lwjgl\lwjgl\2.9.2\a9d80fe5935c7a9149f6584d9777cfd471f65489\lwjgl-2.9.2.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\org.lwjgl.lwjgl\lwjgl_util\2.9.2\4b9e37300a87799856e0bd15ed81663cdb6b0947\lwjgl_util-2.9.2.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\com.badlogicgames.jlayer\jlayer\1.0.1-gdx\7cca83cec5c1b2f011362f4d85aabd71a73b049d\jlayer-1.0.1-gdx.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\org.jcraft\jorbis\0.0.17\8872d22b293e8f5d7d56ff92be966e6dc28ebdc6\jorbis-0.0.17.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\org.lwjgl.lwjgl\lwjgl-platform\2.9.2\510c7d317f5e9e700b9cfaac5fd38bdebf0702e0\lwjgl-platform-2.9.2-natives-windows.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\org.lwjgl.lwjgl\lwjgl-platform\2.9.2\d276cdf61fe2b516c7b7f4aa1b8dea91dbdc8d56\lwjgl-platform-2.9.2-natives-linux.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\org.lwjgl.lwjgl\lwjgl-platform\2.9.2\d55b46b40b40249d627a83a7f7f22649709d70c3\lwjgl-platform-2.9.2-natives-osx.jar;C:\Users\Jakub\.gradle\caches\modules-2\files-2.1\net.
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\idmu\common;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\android-sdk\tools;C:\android-sdk\platform-tools;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
USERNAME=Jakub
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 69 Stepping 1, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows 8.1 , 64 bit Build 9600 (6.3.9600.17415)

CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 69 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2

Memory: 4k page, physical 8290116k(4496800k free), swap 16678724k(11618076k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (25.45-b02) for windows-amd64 JRE (1.8.0_45-b14), built on Apr 10 2015 10:34:15 by "java_re" with MS VC++ 10.0 (VS2010)

time: Fri Jun 26 23:00:19 2015
elapsed time: 0 seconds (0d 0h 0m 0s)

这些是我使用的课程:

  • 我的主要课程

public class Ingens扩展ApplicationAdapter实现Disposable,         InputProcessor {

public static boolean set = false;

int where = 0;

float time = 0;

int place;

public static PrintWriter map;
File mapa;
public static String load;

public static Scanner in;

SpriteBatch batch;
OrthographicCamera gameCamera;

public static int playerPosition;

public static int playerRegionX;
public static int playerRegionY;

public static int playerPartX;
public static int playerPartY;

public static World world;

Box2DDebugRenderer render;

Contacts contacts;

// ALL BLOCKS, ONE BODY, MANY FIXTURES
public static BodyDef blocksB;
public static FixtureDef blocksF;
public static Body allBlocks;
public static PolygonShape square;

Fixture[] fix = new Fixture[64]; // At start we create world!
Fixture[] rendered = new Fixture[64];

public int BLOCK1 = 2;
public int BLOCK2 = 4;

Part part;

@Override
public void create() {

    Textures.textureInitialization();

    Box2D.init();

    // BOX2D STUFF
    world = new World(new Vector2(0, gravity), true);
    contacts = new Contacts();
    world.setContactListener(contacts);
    render = new Box2DDebugRenderer();

    // World made of blocks, one body, many fixtures
    blocksB = new BodyDef();
    blocksB.type = BodyType.StaticBody;
    blocksB.position.set(0, 0); // if bigger or smaller than 0, we need to
                                // /PPM
    allBlocks = world.createBody(blocksB);
    square = new PolygonShape();
    blocksF = new FixtureDef();
    blocksF.filter.categoryBits = Vars.BIT_COMMON_BLOCK;
    blocksF.filter.maskBits = Vars.BIT_COMMON_ENTITY;

    Gdx.input.setInputProcessor(this);
    batch = new SpriteBatch();
    gameCamera = new OrthographicCamera(Gdx.graphics.getWidth(),
            Gdx.graphics.getHeight());

    mapa = new File("map.txt");

    try {
        in = new Scanner(mapa);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }

    part = new Part(0, 0);

    part.saveMap();

    part.close();

}

@Override
public void render() {

    // LOADING MAP

    System.out.println(time);

    // END OF MAP LOADING

    update();

    Gdx.gl.glClearColor(0.6f, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    render.render(world, gameCamera.combined);

    batch.begin();

    Player.draw(world, batch);

    // part.draw(batch);

    batch.end();

    time += Gdx.graphics.getDeltaTime();

    /**
     * // PLAYER Player.work(batch); // PLAYER
     * 
     * PartGenerator.draw(batch);
     **/
    // that should always be at the end
    world.step(1 / 60f, 6, 2);

}

public void update() {

    Input();

    // PLAYER
    // playerRegionX = (int) Math.ceil(Player.player.x / 8 / 32);
    // playerRegionY = (int) Math.ceil(Player.player.y / 8 / 32);

    // playerPartX = (int) Math.ceil(Player.player.x / 32);
    // playerPartY = (int) Math.ceil(Player.player.y / 32);

    // playerPosition = (int) ((Math.ceil(Player.player.x / 32) +
    // Math.ceil(Player.player.y / 32) * regionSizeX));

    // PLAYER

    gameCamera.update();
    gameCamera.position.set(Player.player.getX(), Player.player.getY()
            + Gdx.graphics.getHeight() / 10f / PPM, 0);
    batch.setProjectionMatrix(gameCamera.combined);
    gameCamera.zoom = 5f / PPM;

}

@Override
public boolean keyDown(int keycode) {
    // TODO Auto-generated method stub
    return false;
}

@Override
public boolean keyUp(int keycode) {
    // TODO Auto-generated method stub
    return false;
}

@Override
public boolean keyTyped(char character) {
    // TODO Auto-generated method stub
    return false;
}

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    // TODO Auto-generated method stub
    return false;
}

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    // TODO Auto-generated method stub
    return false;
}

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    // TODO Auto-generated method stub
    return false;
}

@Override
public boolean mouseMoved(int screenX, int screenY) {
    // TODO Auto-generated method stub
    return false;
}

@Override
public boolean scrolled(int amount) {
    // TODO Auto-generated method stub
    return false;
}

@Override
public void pause() {
    Gdx.app.exit();

}

@Override
public void dispose() {
    batch.dispose();
    world.dispose();
    render.dispose();
    Gdx.app.exit();
}

public void Input() {
    if (Gdx.input.isKeyPressed(Keys.W)) {
        if (contacts.playerOnGround == true) {
            Player.player.jump();
        }
    }
    if (Gdx.input.isKeyPressed(Keys.D)) {
        Player.player.moveX(4);
    } else if (Gdx.input.isKeyPressed(Keys.A)) {
        Player.player.moveX(-4);
    } else {
        Player.player.moveX(0);
    }
}

}

  • BlockClass

public class Block扩展了Fixture {

BlockType type;
Shape shape;
float texX;
float texY;

public Block(Body body, long addr, Shape shape, Filter filter, BlockType type) {
    super(body, addr);
    body.createFixture(shape, 0);
    this.type = type;
}

public void draw(SpriteBatch batch, float x, float y){
    batch.draw(type.texture, x, y, 64 / PPM, 64 / PPM);
}

}

  • Part Class

公共类Part {

Block[] blocks = new Block[64];

int x;
int y;


public Part(int x, int y){
    this.x = x;
    this.y = y;

    for(int ID = 0 + x * 64; ID < 64 + x * 64 ; ID++){
        int fY = (int)Math.ceil(ID / (8)) + y * 8; // Fixture Y
        int fX = ID - fY * 8 + x * 8; // Fixture X
            square.setAsBox(32 / PPM, 32 / PPM, new Vector2(fX * 64 / PPM, fY * 64 / PPM - (x * 64 * 8 / PPM)), 0);
            blocks[ID] = new Block(allBlocks, 0, square, blocksF.filter, BlockType.DIRT);
            blocks[ID].texX = fX * 64 / PPM - 32 / PPM;
            blocks[ID].texY = fY * 64 / PPM - 32 / PPM;
            blocks[ID].setUserData(blocks[ID].type);
    }

}

public void draw(SpriteBatch batch){
    for(int ID = 0 + x * 64; ID < 64 + x * 64 ; ID++){
    blocks[ID].draw(batch, blocks[ID].texX, blocks[ID].texY - (x * 64 * 8 / PPM));
    }
}

public void saveMap(){
    try {
        map = new PrintWriter("map.txt");
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } 
    for(int ID = 0 + x * 64; ID < 64 + x * 64 ; ID++){
        map.println(blocks[ID].getUserData() + ",");
    }

    map.close();

}

public void close(){
    for(int ID = 0 + x * 64; ID < 64 + x * 64 ; ID++){
        allBlocks.destroyFixture(blocks[ID]);
    }

}

}

2 个答案:

答案 0 :(得分:0)

Box2D在处理当前时间步长时不允许您删除任何内容。这意味着您需要等待B2World.step()返回才能删除任何内容。因此,如果要删除来自ContactListener的调用中的fixture,或者它将崩溃。相反,您应该使用布尔值标记夹具,然后在物理模拟完成计算后将其删除。

答案 1 :(得分:0)

您应确保从同一线程执行所有box2d操作。