Newb question: animated model in .obj format?

thanks for the tut winkman :wink:

I still had same results as I did before though. when I export to JME the model shows up but with no animation. the animation looks great in blender but when I export it just shows the model in the last position it was in in blender and no animation. not sure what im doing wrong. I tried selecting all and export, selecting just model and not bones, selecting bones and not model, im basically trying everything I can think of.  I know animation works cause I got it working without bones,  but not with bones, any ideas? :?



edit: if I run the animation in blender and then stop it and export to .xml it shows up in jme in whatever position I last stopped it in. but it doesnt animate.

I encountered this problem once and think it was caused by not selecting all bones in the model before inserting a keyframe.

So to set a keyframe: select the desired keyframe in the button window -> select all bones of the mesh in pose mode -> press i and choose (at least) LocRot for each Keyframe

(You can delete keyframes in the NLA editor or timeline by selecting it with RMB and pressing del to get rid of old ones)

…and don't forget to choose Skeletal animation on the exporter.



EDIT: ah, and before exporting the model should be selected (not the armature)



If that is ok and it still doesn't work, then check, the exported xml.

You should have Your base model on top and then a tag <keyframecontroller> followed by many (some) <keyframe> tags each having the data for every vertex position.

Are the keyframes there ?

Are the vertex positions different for different keyframes ? (only some need to be different)

What test app do You use ?

ok I checked the .xml file and the keyframes are all there but the vertex data is the same for each frame.

Im going to try exporting some more tomorrow and see if I can get it to work.

winkman: ive tried everything you suggested and still no luck, I get same results everytime.I did the animation tutorial in the blender manual also and it looks great in blender but I cant get it to export. :?



edit: I just got it to work. :smiley: , problem is I saved to many files and I tried one and it worked but im not sure what I did differently in that one. sigh.

ok I think it has somthing to do with the way im adding armature. It doesnt go from cursor to mouse pointer like in tutorial.When I add the armature it goes from cursor to up one grid and I have to stretch it manually.



edit again: ok I think I finally got it. 8)

when I use 2.37a it works but when I use 2.40 it doesnt. its probably something to do with my setup (being a newb) so y'all dont assume it doesnt work with 2.40  it just doesnt work for me right now. the armature stretches to mouse pointer properly in 2.37a, the prob I mentioned above
was using 2.40

Hm, sorry i've no idea whats going wrong there ???

And i can confirm that it works in 2.40 too, as i did it.

But i got the same error once but it worked on second try, so i never got back investigating.

Does KeyframeController work with .xml files from blender? im having no luck

Yes, it does - i export with the Export Skeletal button (and the other's except object animation) selected and if i load it with TestBinaryXML (modified to take my xml and eventually setting the texture path) it loads it and animates it in a loop.

EDIT: ok, thats the implicitely constructed one from the xml file, so to do some custom animations You will have to get this from the scene-graph and fiddle with it.

im going for differnet animations like run, walk, jump, etc… Im assuming (from looking at dr freak example) that I put all animations together and use keyframe controller to jump to different animations. I made an animation with 30 frames but when I try to add the keyframe controller it wont run at all.

KeyframeController kc=new KeyframeController();
        robot1.addController(kc);
       kc.setNewAnimationTimes(11,20);

Ok, what i was trying to say was:



You don't ADD a keyframe controller because You already have one from loading Your model ! (if You exportet animations of course)

Just retrieve it from the model and use it by setting the begin and end time with

KeyframeController.setNewAnimationTimes(float newBeginTime, float newEndTime)

for the action You want.



(should work that way, but i have not tested this)





examine Your loaded model with something like:



I used your printTree method to examine model node and got:

XML loaded scene
             XML loaded scene
              rootNode
               cube1_cube1_auv_cube
                cube1_cube1_auv_cube1.nocull



I can find no controllers :?
I also tried

robot1.getcontrollers();

and got nada.

Sorry, again i didn't make myself very clear.

The function only prints out the Structure of nodes and meshes.

So You have to try a getControllers() or getController[0] on the parts down the line as the model can consist of more than one animatet meshes if i recall this correct (then each animated mesh has a controller)

or better yet add controller detection like:



public void printTree(Spatial i, int level) {

VERY nice :smiley:

that method is very useful nice work.

I got the keyframecontroller; it was done the tree and I wrote some ugly code to get it but ill fix that later. :wink:

the keyframes are weird numbers like .24 .96 1.16 instead of the 1-30 frames I thought they would be but I can set the keyframes well enough by looking at the .xml file and estimating.woohoo

Nice to hear it's useful to You