[SOLVED] Switching to Minie - Exception on Start

Can someone help me. I’m trying to switch my demo game over to use Minie instead of JBullet.

It compiles, but it when it runs it errors out on statemanager.attach(bulletState);

	bulletAppState = new BulletAppState();
	getApplication().getStateManager().attach(bulletAppState);   <--- Exception points to this line
      // Enable debug visualization to reveal what occurs in physics space.
      bulletAppState.setDebugEnabled(true);

Jan 12, 2022 7:52:52 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.NoClassDefFoundError: jme3utilities/Validate
	at com.jme3.bullet.CollisionSpace.<init>(CollisionSpace.java:157)
	at com.jme3.bullet.PhysicsSpace.<init>(PhysicsSpace.java:267)
	at com.jme3.bullet.BulletAppState.createPhysicsSpace(BulletAppState.java:692)
	at com.jme3.bullet.BulletAppState.startPhysics(BulletAppState.java:619)
	at com.jme3.bullet.BulletAppState.stateAttached(BulletAppState.java:854)
	at com.jme3.app.state.AppStateManager.attach(AppStateManager.java:148)
	at com.landbeyond.wolfstein.GameApp.initialize(GameApp.java:101)
	at com.jme3.app.state.BaseAppState.initialize(BaseAppState.java:132)
	at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:333)
	at com.jme3.app.state.AppStateManager.update(AppStateManager.java:363)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:256)
	at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:578)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:667)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: jme3utilities.Validate
	at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 14 more

Based on the error, it lookad line I’m missing a new jar file that is required.

1 Like

Validate is a class in the “Heart” library. Heart should be pulled in automatically if you build using Gradle or Maven. Since it wasn’t, I’m guessing you’re building with Ant or something similar. See the instructions at

Thanks. That worked.

Now, my character basically flies around now, the long you hold the movement button down. The more height the character gains. Until I let up on the movement button they just gain more and more height.

I looked at the “HelloWalkOtoBcc” example and I’m doing to the same thing and even changed to the same settings and no difference the character just flies.

Any suggestions. The Old JBullet would cause this but basically when you hit corners.

From further testing it is when I step from on grid to the next. The cross over is causing the character to be bumped up and each on does it even more.

My game is a grid layout that is generated from source. So each grid spot has a floor and walls. They are all individual meshes.

I’ve tried doing the batchnode on the floor and walls and I get the same results, when the character cross the floor from one mesh to the next the physics causes the bump and the character flies upward.

[Edit]
Forgot. All floors and Walls are Box (40,40,1) basically. they are 40x40 with a depth of 1.

To avoid bumps, the entire floor needs to be a single physics object. I suggest using a MeshCollisionShape. It’s not necessary that the floor be a single JME mesh (though that would make things easier).

Okay, This appears to work nicely.

CollisionShape boxShape = CollisionShapeFactory.createMergedBoxShape(floorBatch);
1 Like

I’m very glad to hear you got it working.

A couple related points I’d like to mention:

  • createMergedBoxShape() returns a CompoundCollisionShape, not a MeshCollisionShape.
  • For performance reasons, all non-movable solid objects (not just floors) should ideally be merged into a single rigid body.

So MeshCollisionShape takes only a mesh. So how do you do that when there are 100 difference meshes.

Is the best practice just to loop through all the Nodes and get the meshes and create a list of them to pass it to collicionshape?

Or is there something else.

I loop through to create floors. It generates a bunch of Geometries and adds them to a “Floor” node to easy control.

So would I just loop through the children and get the meshes and then be able to send it over to the mesh collision class. or something else.

Just want to make sure I’m doing this the best practice.

Thanks

1 Like

To create a MeshCollisionShape from multiple JME meshes, use the following constructor:

https://stephengold.github.io/Minie/javadoc/master/com/jme3/bullet/collision/shapes/MeshCollisionShape.html#<init>(com.jme3.scene.Mesh...)

That assumes that all the meshes share the same world transform. If not, then you have a couple other options. If there’s no terrain, then use

https://stephengold.github.io/Minie/javadoc/master/com/jme3/bullet/util/CollisionShapeFactory.html#createMergedMeshShape(com.jme3.scene.Spatial)

If terrain is included, then use

https://stephengold.github.io/Minie/javadoc/master/com/jme3/bullet/util/CollisionShapeFactory.html#createMeshShape(com.jme3.scene.Spatial)

For your worf3d clone you can replace all your floor “boxes” by a single big quad or box, since in wolfenstein 3d all the floor surfaces are of the same height.

Thought about that. It would work easy for the clone. Just wanted to do one that I could expand on that didn’t have the same height.

Wolf3d is so simple, floor all on same height coords. Also, if I didn’t want to expand, I thought about using “PlaneCollisionShape” that would make floor easy.

Yeah, if you wanted to stay limited to a single elevation then plane collision shape would be superior.

…it’s probably not a bad idea for the bottom of the world either way.

1 Like