gdx2d icon indicating copy to clipboard operation
gdx2d copied to clipboard

DemoPolygonPhysics crashes when run standalone

Open RandomReaper opened this issue 8 years ago • 3 comments

but it runs in the DemoSelector

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape()J at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127) Caused by: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape()J at com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape(Native Method) at com.badlogic.gdx.physics.box2d.PolygonShape.(PolygonShape.java:29) at ch.hevs.gdx2d.lib.physics.AbstractPhysicsObject.createPolygonObject(AbstractPhysicsObject.java:98) at ch.hevs.gdx2d.lib.physics.AbstractPhysicsObject.(AbstractPhysicsObject.java:57) at ch.hevs.gdx2d.components.physics.primitives.PhysicsPolygon.(PhysicsPolygon.java:43) at ch.hevs.gdx2d.demos.physics.DemoPolygonPhysics.onInit(DemoPolygonPhysics.java:54) at ch.hevs.gdx2d.desktop.Game2D.create(Game2D.java:174) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)

RandomReaper avatar May 11 '16 11:05 RandomReaper

It seems the physics world is not initialized. PhysicsWorld.getInstance() fix it...

RandomReaper avatar May 11 '16 11:05 RandomReaper

Good point @RandomReaper I tested with the demo selector gdx2d-demoDesktop-1.2.1.jar and it doesn't work either. If no other physics demo are launched before the DemoPolygonPhysics, the bug also appears in the demo selector.

I am not sure if we should really initialize the physics world for all applications because not all the demo use the `PhysicsWorld``...

metc avatar May 11 '16 21:05 metc

The demo works if another demo using physics and calling PhysicsWorld.getInstance() have been run before...

I think creating an unused variable using PhysicsWorld.getInstance() in the constructor of the PortableApplication is counter-intuitive and initializing the physics world is not so expensive.

RandomReaper avatar May 12 '16 05:05 RandomReaper