I am trying to load a model in my game (currently just a slightly modified helloaniamtion). The model is one that comes as an example with the Ogre exporter script for Blender that you can download here: http://blender2ogre.googlecode.com/files/blender2ogre-0.5.4.zip (examples/armature-test.blend is the file I am talking about). I use Ogre Exporter 0.5.4 in Blender to convert the file to the Ogre file format (I use the default options to export, except from the options ‘Export Scene’ and ‘Export Selected Only’, which I untick). Than I load it in to JMP (nightly build, because I have troubles with the stable version). Until here everything goes fine. I can see it in the Scene Composer. But when I try to load it in my ‘game’ and I hit the Spacebar to start the animation, nothing happens. Here is the code that I use:
Hm, code looks fine from what I can see… You get no errors I suppose? Only thing is you check for an animation called “Walk” and then set one called “my_animation”, tho if thats the correct animation it should work (tho it will “reset” the animation when pressed while its running).
Yea, I wasn’t that clear in my question. When I open my model in the Scenecomposer, I can see the properties of it down left. There is a tree displayed with one of the elements (leafs) in it called AnimControl. When I click on it, on the right side of the screen the properties appear. There is a dropdownlist with as label ‘Animation Control’ where I can switch between the different animations. There is one animation called ‘my_animation’. So In my code I try to play ‘my_animation’ instead of ‘walk’. I have only changed ‘walk’ into ‘my_animation’ where I think it is nessessary to do a quick test.
But I’m gonna try another model now. Hope this will work better. I just wanted to know why it didn’t work, but I see it isn’t that simply as I thought it would be:)
@normen: It looks imported models of the newest dotscene version are having problems with animations :/, I can’t play animations of an model which was imported using the newest dotscene version. Anyway I can play the Sinbad’s animations very well. I’ll keep testing it. Also, animations aren’t played properly of imported .blend models(sometimes the model disapears when an animation is played, and if the animation is played, it’s not played like in blender).
What is ‘the newest dotscene version’? The SDK comes with an export script that should be working for Blender 2.5+. You can install it via Tools->OgreXML
I’ve tested both via OgreXmlTools and googlecode. The AnimControl and SkeletonControl appears in SceneComposer, but the loaded node in source code has 0 num of controls. And animations of converted blend files aren’t played properly, and in source code it has 0 num of controls too.
-If I convert the sinbad.mesh.xml to sinbad.j3o and open it in SceneComposer, I can play its animation very well.
-If I convert a custom model I did Cube.mesh.xml to Cube.j3o and open it in SceneComposer I can play its animation too, but it doesn’t follow the bone movements…I’ve loaded the animated cube in source code, and attached a SkeletonDebugger, and I can see the bone being animated, but the cube keeps static. Also, converting the whole scene(.scene) to j3o and opening it in SceneComposer, I can see the AnimControl and SkeletonControl, but when I load it in source code, it has 0 controls. The same for .blend models.
Hey, I toogled line breakpoints on write and read method of the MeshAnimation class from my jMonkeyEngine3 working copy so I can check what’s going wrong, but I don’t know how to debug it on SDK. How can I do it?
glaucomardano said: @normen: It looks imported models of the newest dotscene version are having problems with animations :/, I can't play animations of an model which was imported using the newest dotscene version. Anyway I can play the Sinbad's animations very well. I'll keep testing it. Also, animations aren't played properly of imported .blend models(sometimes the model disapears when an animation is played, and if the animation is played, it's not played like in blender).
Yeah, and I was true, I've made several tests and now finally I found the problem -.-. The problem is in dotscene for blender 2.59(that one provided by jMonkeyPlataform via OgreXml tools), the dotscene for blender 2.49 works fine. If you install it in blender 2.59 and export the animated model to jmp, jMonkeyEngine will don't import the animations properly, then the animations will doesn't work(the animcontrol and skeletoncontrol will be there, and the animations too, but they will don't work). The dotscene for blender 2.49 works fine in jmp :), then my solution is to use it at moment(that's not really good news, the old blender is a shit :D). Then the problem is probably in OgreXmlImporter, or in blender2ogre itself :/. Also, I've checked the .mesh.xml files both for 2.49 and 2.59, and I already know what's the problem: In 2.49 .mesh.xml files there are [xml]<geometry></geometry>[/xml] tags, and in 2.59 .mesh.xml files there are [xml]<sharedgeometry></sharedgeometry>[/xml] tags, then the problem is probably OgreXmlImporter doesn't supporting [xml]<sharedgeometry></sharedgeometry>[/xml] tags.
I've made some tests with the BlenderLoader too, it does load an animated model in jmp, but whenever an animations is played, the model disapears or the animation is not played properly(bugged). Although OgreXmlImporter does work fine with blender 2.49, it doesn't mean BlenderLoader does too. Then:
-Have to be done a fix in OgreXmlImporter(or in blender2ogre itself) for animation support.
-Have to be done a fix in BlenderLoader for animation support.
I think @Momoko_Fan have to be invited to this conversation too.