내 게임 충돌에 가끔 충돌을 Box2D의libgdx는 createBody
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.badlogic.gdx.physics.box2d.World.jniCreateBody(JIFFFFFFFFZZZZZF)J+0
j com.badlogic.gdx.physics.box2d.World.createBody(Lcom/badlogic/gdx/physics/box2d/BodyDef;)Lcom/badlogic/gdx/physics/box2d/Body;+80
j de.tennoxlab.cellolution.Food.<init>(Lde/tennoxlab/cellolution/CellWorld;FFZZ)V+115
j de.tennoxlab.cellolution.CellWorld.generateFood(IFFFFZ)V+54
J 89 C2 de.tennoxlab.cellolution.CellWorld.update()V (159 bytes) @ 0x00000000024623b4 [0x0000000002461c60+0x754]
j de.tennoxlab.cellolution.Cellolution.render()V+40
j com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop()V+698
j com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run()V+27
v ~StubRoutines::call_stub
전체 로그 : 비슷한 충돌 모든 다른 게시물에서 http://pastebin.com/QjY3msYS
그것은 일어나지 않아야 할 때 아마 세계 수정 일 것입니다. 식품 생성자
// generateFood() - called during World.update
for (int i = 0; i < count; i++) {
float x = minX + (float) Math.random() * (maxX - minX);
float y = minY + (float) Math.random() * (maxY - minY);
Gdx.app.debug("World", "Generating food piece "+i);
this.foods.add(new Food(this, x, y, animateGrowth, this.renderable));
}
: 충돌은 새로운 식품 객체의 생성 중에 발생
// in Food(...) constructor
BodyDef bodyDef = new BodyDef(); //TODO: set to sleep on init?
bodyDef.type = BodyDef.BodyType.DynamicBody;
bodyDef.position.set(x, y);
bodyDef.linearDamping = 0.5f;
bodyDef.angularDamping = 1f;
Gdx.app.debug("Food", "Init body with " + bodyDef + " at " + x + "," + y);
foodBody = world.box2dWorld.createBody(bodyDef); // <== HERE IS WHERE THE CRASH HAPPENS
CircleShape shape = new CircleShape();
shape.setRadius(getSizeFromEnergy());
fixtureDef = new FixtureDef();
fixtureDef.shape = shape;
fixtureDef.density = 0.5f;
fixtureDef.friction = 0.4f;
fixtureDef.restitution = 0.2f;
fixture = foodBody.createFixture(fixtureDef);
fixture.setUserData(this);
shape.dispose();
그러나 generateFood 코드가 성공적으로 실행되었을 때 그것은 단지 (때로는 게임 플레이의 분, 이따금 발생 수백 번). 그래서 저는 추락이 음식 세대 이전에 일어났던 일과 관련이 있어야한다고 생각했습니다.
World: Generating food piece 99
Food: Init body with [email protected] at -28.201607,-56.101532
World: Removing cell: de.tenno[email protected]
Cell: Destroying [email protected] at -51.92446,-56.464954
World: Removing cell: [email protected]
Cell: Destroying [email protected] at -51.92446,-56.464954
World: Generating 100 new food pieces
World: Generating food piece 0
Food: Init body with [email protected] at 14.653984,96.249084
[...]
World: Generating food piece 21
Food: Init body with [email protected] at -15.35305,13.934067
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000066bcbd0d, pid=9792, tid=13288
#