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
Is it because the SDK uses different classes than the programmer does?
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.
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
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.
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!
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