How to use .j3o files? (11 posts)

  • Profile picture of refinedcode refinedcode-1p said 1 year, 4 months ago:

    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!

  • Profile picture of normen normen1290p said 1 year, 4 months ago:

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

  • Profile picture of refinedcode refinedcode-1p said 1 year, 4 months ago:

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

            Node b = (Node) assetManager.loadModel("Models/GarbagePod.j3o");
    
            geom = (Geometry) b.getChild(0);
    
            rootNode.attachChild(geom);

    Is that wrong?

    Thanks!

  • Profile picture of nehon nehon591p said 1 year, 4 months ago:

    So, and what’s the error?
    Do you have an exception or just a bad display?

  • Profile picture of refinedcode refinedcode-1p said 1 year, 4 months ago:

    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.

  • Profile picture of normen normen1290p said 1 year, 4 months ago:

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

  • Profile picture of refinedcode refinedcode-1p said 1 year, 4 months ago:

    Ok I changed my code to

            b = (Spatial) assetManager.loadModel("Models/GarbagePod.j3o");
    
            rootNode.attachChild(b);

    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!

  • Profile picture of rennolaj rennolaj said 2 months, 4 weeks ago:

    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

  • Profile picture of normen normen1290p said 2 months, 4 weeks ago:

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

  • Profile picture of rennolaj rennolaj said 2 months, 4 weeks ago:

    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

  • Profile picture of normen normen1290p said 2 months, 4 weeks ago:

    Because the animation is not correct
    Check the tutorials that the end of this tutorial (and best to the tutorial too)

    http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_asset