[Solved] Animation Troubles

Just had to update JME. The version of JME3 I had had some failed OGRE animation support I guess. Went to tool → plugins and updated in the updates tab and my code worked as is.



I've been attempting to get my animations to work in JME. I'm not certain if it's a problem with the OGRE exporter or if I'm just doing it wrong in blender or in my code, so if anyone could give me an idea of what might be wrong, that would be extremely helpful. I've been at it for a few days.



This is the two .blend file tests I made in blender 2.6, one of them should have the animation on the dopesheet while the other has been completed (I was thinking maybe I am naming the animation wrong in blender or my bones might have a problem): http://samuelpeterson.org/CubeGuySource.zip


I have been using the OGRE exporter here: http://code.google.com/p/blender2ogre

Below is the code that makes it go. It will show the object I made and load the mapped texture, but the animation was a no go.

[java] @Override
public void simpleInitApp() {
flyCam.setMoveSpeed(25);
Spatial CubeGuy = assetManager.loadModel("Models/CubeGuy.mesh.xml");
//Material mat_default = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
Material mat_default = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");

Texture tex = assetManager.loadTexture(new TextureKey("Textures/TexturemapRev2.png", false));
//Texture tex = assetManager.loadTexture("Textures/TexturemapRev2.png");
tex.setWrap(Texture.WrapMode.Repeat);


mat_default.setTexture("NormalMap", tex);
mat_default.setTexture("DiffuseMap", tex);
//mat_default.setTexture("ColorMap", tex);

CubeGuy.setMaterial(mat_default);

//CubeGuy.scale(1.05f, 1.05f, 1.05f);
//CubeGuy.rotate(-1.5f, 0.0f, 0.0f); // Normalize it if it is not already
CubeGuy.setLocalTranslation(0.0f, 0.0f, 0.0f);

rootNode.attachChild(CubeGuy);


control = CubeGuy.getControl(AnimControl.class);
channel = control.createChannel();



// You must add a light to make the model visible

DirectionalLight sky = new DirectionalLight();
sky.setColor(ColorRGBA.White.mult(3f));
sky.setDirection(new Vector3f(-5f, 0f, -1f).normalizeLocal()); // x y z - | .
rootNode.addLight(sky);

AmbientLight ambiance = new AmbientLight();
ambiance.setColor(ColorRGBA.White.mult(3f));
rootNode.addLight(ambiance);




control = CubeGuy.getControl(AnimControl.class);
channel = control.createChannel();

//System.out.println("
nn "+channel.getAnimMaxTime()+"
");
channel.setAnim("Walking", 1f);
channel.setLoopMode(LoopMode.Cycle);
channel.setSpeed(1f);
}[/java]

Try to add this:



[java]



control.getChannel().setAnim("Walking");

control.getChannel().setSpeed(1f);

control.getChannel().setLoopMode(LoopMode.Loop);

[/java]

I think the mesh laughed at me. It didn’t move even when using the getChannel() method.



I forgot to mention, I’m not getting any error messages in regards to this. It just doens’t move. I tested my 3D ogre model in the tutorial code for 3D animation with no success, so I think I am probably doing something wrong outside of JME3. I’ve never actually used blender to create a model and animate it before this, so I guess I either did something wrong in blender when making the model or the Ogre exporter might not be working. A tutorial that walks through making even a basic 3 sectioned cube pillar animation and implementing it would help out, that way I would at least know if I’m doing it right or not. I’ve tried more basic things than my cubeguy with no success thus far.



If JME3 supports animations and UV mapping in .blend files, that could help me weed out the ogre exporter being an issue, but I have no idea how to load just a single object from my .blend file.





Update


So after looking further into it I found a way to load my .blend file up and just use the mesh directly from that. The animation works great. However I can't load a texture on because the UV mapping isn't complete in JME. It seems there is just something wrong with the OGRE exporter I guess.