How to use .j3o files?

Hi guys. I used the blender plugin for jmonkeyplatform to take my .blend file into a .j3o file. I am doing this because when i exported as Ogrexml the UV maped texture i made in blender didnt quite go on my model once loaded in JME so I found the plugin. Now how do I load this .j3o file? Loading it like a normal mesh just wont work. Any suggestions or tips would be appreciated!

The path is important, you have to load it on the path it was imported.

I think i have the path… Here is my code:



[java] Node b = (Node) assetManager.loadModel("Models/GarbagePod.j3o");



geom = (Geometry) b.getChild(0);





rootNode.attachChild(geom);[/java]





Is that wrong?



Thanks!

So, and what’s the error?

Do you have an exception or just a bad display?

Jan 20, 2011 11:14:11 AM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.ClassCastException: com.jme3.scene.Node cannot be cast to com.jme3.scene.Geometry
at mygame.Main.simpleInitApp(Main.java:35)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:186)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:134)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:188)
at java.lang.Thread.run(Thread.java:662)


That was the error. Sorry I didnt think to post it before.

Uh, the error is in line 3, apparently child 0 is not a Geometry… The model loads fine.

Ok I changed my code to



[java] b = (Spatial) assetManager.loadModel("Models/GarbagePod.j3o");



rootNode.attachChild(b);[/java]



EDIT: SIlly me, the reason this was black was because I did not apply the texture yet. My texture w/ UV mapping is working great now. The .blend file importer is really helpful! THanks for the help!

Do you guys know how to use the animations on a j3o model? my XML exporter from blender is skiping the animation on the skeleton so I cant use them

If it skips the animation the animation isn’t correctly done. You need a bone animation with one root bone.

but it makes all the bones but skips the animation on the Skeleton , and if I try it on the SDK on the .j3o model and you look for the animations they all work so I dont understand why the XML exporter is not working

Because the animation is not correct

Check the tutorials that the end of this tutorial (and best to the tutorial too)

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_asset