RigidBodyControl doesn't work in 3.1 SDK anymore?

Hello again,
I am currently using JME 3.1 beta (with SDK) and I tried to work with phyiscs again. The problem I have is that when I add a RigidBodyControl in the SDK to a spatial (e.g. a node with a cube attached to) and load this .j3o file in code with the assetManager the whole application crashes.

The code looks as follows:

@Override
public void simpleInitApp() {
    
    BulletAppState bulletAppState = new BulletAppState();
    stateManager.attach(bulletAppState);
    
    Spatial object = assetManager.loadModel("Scenes/PhysicalObject.j3o");
    rootNode.attachChild(object);
    
    bulletAppState.getPhysicsSpace().addAll(object);
    
}

When I execute the program I can see this on the console:
Bullet-Native: Initializing java classes C:\Users\Domenic\AppData\Roaming\.jmonkeyplatform\3.1.0-beta1-SNAPSHOT\var\cache\executor-snippets\run.xml:53: Java returned: -1073741571 BUILD FAILED (total time: 23 seconds)

But on the other side, if I add the RigidBodyControl in code it does work perfectly (control was removed before).

@Override
public void simpleInitApp() {
    
    BulletAppState bulletAppState = new BulletAppState();
    stateManager.attach(bulletAppState);
    
    Spatial object = assetManager.loadModel("Scenes/PhysicalObject.j3o");
    object.addControl(new RigidBodyControl(0));
    rootNode.attachChild(object);        
    
    bulletAppState.getPhysicsSpace().addAll(object);
    
}

I really would like to work with the SDK :disappointed:

Is it because the SDK uses different classes than the programmer does?


I really would appreciate an answer!

umm… either I don’t get it or you don’t get it. The first code is wrong, because you shouldn’t put spatial in physics. You have to put physics controllers in the physics. The second code is correct. You should do it like that.

Did you read the tutorials? The ones at http://davidb.github.io/sandbox_wiki_jme/jme3.html ?

Seriously, I have no idea what you were doing in the first code, no offense. Maybe it’s outdated and Devs removed it I 3.1.

This is a summary on how to physics:

  1. Make a RigidBodyControl , or any other PhysicsControl.
  2. Attach the control to the physics space provided in a BulletAppState.
  3. Add the RigidBodyControl to a Spatial as a control.
  4. Done

Adding the Spatial to the PhysicsSpace does add its control, it’s just a Shortcut.

The Problem is this seems like a crash when initializing Native Bullet? Is this only when you have that attachChild() inside?

Try deleting the bullet*.so files, maybe they are outdated. This seems like a crazy crash without debugging information

This line occurs the error:
Spatial object = assetManager.loadModel("Scenes/PhysicalObject.j3o"); // object contains a rigidbodycontrol

If I remove the “physics libraries” BulletAppState can (of course) not be found anymore. I also tried to remove those 2 libraries and add the “jbullet” library, but then some classes are missing :disappointed:

Hmm quite strange, did you use an old SDK project on the new 3.1?
I’m actually using the rigid body control and everything is fine for me! (With SDK 3.1 ALPHA)

There is 1 difference, i add my control with Actual code, i didn’t add it from the SceneExplorer.
You should try to work with a basic cube and see by your self, the code will work perfectly fine.

Yes, when I add the control via code it does work, otherwise (in Scene Explorer) it does not!
Could you please try it on your SDK, please?

Alright let me 5 second. Edit: 5 min lol

Test done everything worked fine

        BulletAppState bulletAppState = new BulletAppState();
        stateManager.attach(bulletAppState);

        Spatial object = assetManager.loadModel("Scenes/Test.j3o");
        rootNode.attachChild(object);

        bulletAppState.getPhysicsSpace().addAll(object);
        bulletAppState.setDebugEnabled(true);

@n3cr0 Thank you!
Is it about my SDK then? Did I maybe do something wrong during the installation or so ?

One thing I would have to say, could you post the actual error?

Hmm, probably your models, try to open blender and save the cube as a OBJ(to make it simple) and in the scene explorer try to add the bullet physic rigidbody, If you miss library i can’t really help here i could probably give you a screen shot of my own sdk library but will it really help? maybe so i will give a shot and compare!

There is not really an error. The only Thing I can see is on the console and this message when start the game:


It is german and does mean something like: “Java™ Platform SE binary does not work anymore”

What’s the console error?

Bullet-Native: Initializing java classesC:\Users\Domenic\AppData\Roaming\.jmonkeyplatform\3.1.0-beta1-SNAPSHOT\var\cache\executor-snippets\run.xml:53: Java returned: -1073741571BUILD FAILED (total time: 23 seconds)

This is how your lib should be

I know it s may look stupid but did you try build and compile? then retried to run?

Have the same now. But then I get the following error:
java.lang.NoClassDefFoundError: com/bulletphysics/collision/dispatch/CollisionConfiguration at com.jme3.bullet.BulletAppState.startPhysics(BulletAppState.java:164) at com.jme3.bullet.BulletAppState.stateAttached(BulletAppState.java:211) at com.jme3.app.state.AppStateManager.attach(AppStateManager.java:133) at mygame.Main.simpleInitApp(Main.java:27) at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:220) at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130) at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: com.bulletphysics.collision.dispatch.CollisionConfiguration at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 8 more