[SOLVED] JmeTests and the problems with jbullet/bullet

I can’t run the test examples in JmeTests (the built-in example project) that have to do with jbullit and/or bullit. I get the same errors that others have previously written about here in the forum but I still fail to understand how those discussions apply in my case. They honestly seem to not at all apply as they relate to older versions of jMonkeyEngine and to libraries that are not part of my recently downloaded version of NetBeans/the jME3 SDK (that I run on a mac, but that should not matter).

I have fixed the java version from the default 6 to 8 (well, 1.8) and I have read about the once upon a time conflicting libraries. But as I understand it, there is now just one bullit library (jme3-jbullit) around. My search through old posts and documentation has ended up with basically nothing. I am now very frustrated and totally stuck.

Could someone please once for all sort out how to make all code in JmeTests work “out of the box”?

The error in a nutshell (I think):

… JmeTests/src/jme3test/bullet/PhysicsHoverControl.java:187: error: cannot access MotionState
class file for com.bulletphysics.linearmath.MotionState not found

What version of the SDK are you running?

Good question. I’m running jMonkeyEngine SDK 3.1.0-stable-FINAL, Netbeans 8.2 patch 2.

Downloaded and installed just a couple of weeks ago. (And I have not tempered with it since.)

jMonkeyEngine programs I have written myself work fine but, then, they do not use everything in the examples.

(I took screen shots (PNG:s) of the list of libraries in the project and the list of compile-time libraries but get an error when I try to upload them.)

I have no idea why I can’t upload images (I just get a dialog box that says it is not possible and tells me to try again later…) so instead I uploaded them to myfile.org. To the best of my knowledge, there is nothing fishy with that site so I hope this is allowed here in this forum.

The compile-time libraries:

The list of libraries (jars) in the project:

Hope that helps.

Do you have 32 or 64bit CPU?

64 bit. It’s a fairly recent mac. In fact, I have three macs and the same problem on all of them (all 64 bit).

Image upload to the forum has been disabled for months due to a shortage of disk space on the server.

There are 2 changes required to run the JmeTests with 3.1.0-stable SDK:

  1. change the source/binary form from “JDK 6” to “JDK 7” or “JDK 8” AND
  2. replace the “jme3-jbullet” library with both “jme-bullet” and “jme3-bullet-native”.

If you’re getting an error in PhysicsHoverControl, that implies that you tried to run TestHoveringTank. With the changes described above, the test works for me.

The “cannot access MotionState” error is exactly the error I get if I build using the “jme3-jbullet” library. See requirement #2 above.

Not sure that’s going to happen. You can fix almost everything with basic java knowledge but for those things that are jme3 specific, like deprecated things, its a great learning experience if you read the wiki. I have found it to be enjoyably challenging myself.

I will help you with the Hover Tank file though. Heres a diff file from my changes.

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- a/<html>TestHoveringTank.java (<b>Mar 12, 2017 11:06:33 AM</b>)</html>
+++ b/<html><b>Current File</b></html>
@@ -54,9 +54,9 @@
 import com.jme3.renderer.queue.RenderQueue.ShadowMode;
 import com.jme3.scene.Geometry;
 import com.jme3.scene.Spatial;
-import com.jme3.shadow.PssmShadowRenderer;
-import com.jme3.shadow.PssmShadowRenderer.CompareMode;
-import com.jme3.shadow.PssmShadowRenderer.FilterMode;
+import com.jme3.shadow.CompareMode;
+import com.jme3.shadow.DirectionalLightShadowRenderer;
+import com.jme3.shadow.EdgeFilteringMode;
 import com.jme3.terrain.geomipmap.TerrainLodControl;
 import com.jme3.terrain.geomipmap.TerrainQuad;
 import com.jme3.terrain.heightmap.AbstractHeightMap;
@@ -64,6 +64,7 @@
 import com.jme3.texture.Texture;
 import com.jme3.texture.Texture.WrapMode;
 import com.jme3.util.SkyFactory;
+import com.jme3.util.SkyFactory.EnvMapType;
 import java.util.ArrayList;
 import java.util.List;
@@ -110,18 +111,10 @@
         bulletAppState = new BulletAppState();
-//        bulletAppState.getPhysicsSpace().enableDebug(assetManager);
+//        bulletAppState.setDebugEnabled(true);
-        rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
+        rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", EnvMapType.CubeMap));
-        PssmShadowRenderer pssmr = new PssmShadowRenderer(assetManager, 2048, 3);
-        pssmr.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal());
-        pssmr.setLambda(0.55f);
-        pssmr.setShadowIntensity(0.6f);
-        pssmr.setCompareMode(CompareMode.Hardware);
-        pssmr.setFilterMode(FilterMode.Bilinear);
-        viewPort.addProcessor(pssmr);
@@ -131,6 +124,16 @@
         dl.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal());
+        /* Drop shadows */
+        final int SHADOWMAP_SIZE=2048;
+        DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, SHADOWMAP_SIZE, 3);
+        dlsr.setLambda(0.55f);
+        dlsr.setShadowIntensity(0.6f);
+        dlsr.setShadowCompareMode(CompareMode.Hardware);
+        dlsr.setEdgeFilteringMode(EdgeFilteringMode.Bilinear);
+        dlsr.setLight(dl);
+        viewPort.addProcessor(dlsr);
         Vector3f lightDir2 = new Vector3f(0.70518064f, 0.5902297f, -0.39287305f);
         DirectionalLight dl2 = new DirectionalLight();
         dl2.setColor(new ColorRGBA(0.7f, 0.85f, 1.0f, 1f));
@@ -168,7 +171,6 @@
         Spatial missile = assetManager.loadModel("Models/SpaceCraft/Rocket.mesh.xml");
         missile.rotate(0, FastMath.PI, 0);
-        //missile.updateGeometricState();
         BoundingBox box = (BoundingBox) missile.getWorldBound();
         final Vector3f extent = box.getExtent(null);

It runs fine without changes though.

Thank you very much for explaining in detail what to do, @sgold! I’m certain I’m not the only one grateful for that.

Just one thing: I do not know where to get jme-bullet and jme3-bullet-native. Are they already included somewhere in the 3.1.0-stable SDK distribution I downloaded? Or where can they be found?

In the top and left of this forum is a link to the wiki.

Under this,

you will see a link to this,

which surprisingly has this topic…

The 3.1 libraries are included in the SDK, and also downloadable from GitHub and JFrog.

To access them in the SDK, right-click on a NetBeans project (such as JmeTests) to access its popup menu, select the “Properties” menu item, under “Categories:” select “Libraries”, and click on the “Add Library…” button.

The only part I’m not sure about is how you access a project’s popup menu if you don’t have a 3-button mouse.

@sgold see the link above with jme3tests.

Will save you a lot of typing…

FYI I think the MotionState Thing was due to missing jbullet.jar inside of jme3-jbullet (however this should have been fixed with the sdk, maybe not in time for stable).

Would be nice if someone could confirm that

Many thanks to you all! It works fine once I substitute the libraries.

1 Like