Hello,
I have a problem, so I am sorry but I have to write my first topic here.
I have created a small animation in Blender (see the pictures below). In this case a cube moves from position A to position B.
It’s not such a difficult animation.
http://s1.directupload.net/images/121101/vnys8qln.jpg
http://s7.directupload.net/images/121101/a9mdt4a3.jpg
After this, I’ve used the ogre exporter and put the files into my jmonkey assets/models folder.
The small program I’ve written is the following. If I start the animation, it doesn’t work and abort with the following message:
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
I really don’t know, where my problem is. It’s only a small test program and animation, but the animation doesn’t run. Can somebody tell me me where the problem is? I have read that I have to use armatures, so i have used an armature, but it doesn’t work.
My program:
public class Main extends SimpleApplication
implements AnimEventListener {
public static void main(String[] args) {
Main app = new Main();
app.start();
}
@Override
public void simpleInitApp() {
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
rootNode.addLight(sun);
Spatial scene = assetManager.loadModel(“Models/robot/test.scene”);
rootNode.attachChild(scene);
control = player.getControl(AnimControl.class);
control.addListener(this);
channel = control.createChannel();
channel.setAnim(“my_animation”);
}
@Override
public void simpleUpdate(float tpf) {
//TODO: add update code
}
@Override
public void simpleRender(RenderManager rm) {
//TODO: add render code
}
Node root;
Node player;
AnimChannel channel;
AnimControl control;
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
}
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
}
}
Make sure you did everything like here:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:external:blender
Another working example:
http://dl.dropbox.com/u/26887202/123/jme_blender/characterOgre26.zip
Hey,
thank you for your quick response. I have tested the model and it is running fine.
The thing is, that I would like to import a very very easy animation from blender to jmonkey, for example the movement of a cube from position A to B.
I don’t need any bone animations or something like that, but I have unterstood, that I can only do that with bones.
How can I realize that? I have only trivial cube movements with keyframes, which I need to import in jmonkey, but I don’t have any idea how I can do that.
you can’t make it without bones. (even keyshapes are not supported, only bones)
you can make Parent Bone of Cube and move this Parent bone, then it will work.
you can also use JME cinematic class to make it via code.
Thank you for your help, the combination of cinematics and motionpath seams a good solution.
I will try it, otherwise I will come back. hehe
Can you post the entire stack trace? Are you sure the skeleton.xml file is in the same folder as the mesh.xml file?