ms3d problem

im having a problem with my MS3D model loader, it keeps giving a null pointer exception, my model loader is for an animated model that walks, can anyone see whats wrong with it, thanks

public static Node loadModel( String modelUrl )//, String textureUrl)
        Node gamemap = new Node();
        URL modelURL=ForceFieldFence.class.getClassLoader().getResource(modelUrl);
      // URL textureURL=ForceFieldFence.class.getClassLoader().getResource(textureUrl);
        BinaryImporter importer = BinaryImporter.getInstance();
        //FormatConverter converter=new MilkToJme();
        MilkToJme converter=new MilkToJme();
        ByteArrayOutputStream BO=new ByteArrayOutputStream();
        try {
            converter.convert(modelURL.openStream(), BO);
            gamemap=(Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
            gamemap.setCullMode( SceneElement.CULL_NEVER );
            gamemap.setModelBound(new BoundingBox());
          /* Texture t = TextureManager.loadTexture(textureURL,1,100);
            TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        } catch (IOException e) {
        return gamemap;

ok, i have changed the code around, i dont understand, it works for a 3ds models but not for an MS3D model, the error given now is that the file cannot be opened, the path is correct, did anyone have a problem with this? could there be a problem with how i have saved my animated model? I have included the code below

public static Node loadModel() {
         FormatConverter milktojme = new MilkToJme();  //the converter
         Node node = null; //Where to dump mesh.
         ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
         milktojme.setProperty("texdir","character/zombie/");//For loading the raw file
//          File Path for the model (dump file in toplevel of classpath)
         URL url = Bot.class.getClassLoader().getResource("/character/zombie/zombie03.MS3D");
         //InputStream is=null;
         try {
            milktojme.convert(url.openStream(), bytearrayoutputstream);
         } catch(Exception err)  {
             System.out.println("Could not open Model file: "+err);
         try {
             // Converts the file into a jme usable file
            // milktojme.convert(is, bytearrayoutputstream);
             // Used to convert the jme usable file to a TriMesh
             BinaryImporter binaryImporter = new BinaryImporter();
             ByteArrayInputStream in=new ByteArrayInputStream(bytearrayoutputstream.toByteArray());
             //importer returns a Loadable, cast to Node
             node = (Node)binaryImporter.load(in);
         } catch(Exception err)  {
             System.out.println("Error loading md3 model:"+err);
//         attach node to scene graph
         return node;

Ok, i got it working, just the model is on its side, would i have to do the same for 3ds and rotate it on its side in the 3d max application, has anyone had this prop?

Hi sniper

i'm very new to jme and i have a similar problem: my model loads including animation but without texture. after hours of searching in the forum I'm a bit frustrated right now. Could you post your solution please?

Besides: 3ds uses a bit a different coordinate System, so you have to translate your model after you loaded it (how this works in jme, i can't tell you yet, sorry).

Thanks in advance!

The MD5 loading contrib package has a method in there to rotate the loaded models up to the proper position, however I don't remember what it is off hand.  I'll let you know later today if someone hasn't already answered or you didn't grab it out of the contrib CVS.  It's a fairly simple method, but details escape me.

May or may not be what you're looking for:

   public static void tdsRotation(Node node){
      for( int i=0;i<node.getQuantity();i++){
         Spatial tmp = (Spatial)node.getChild(i);
         tmp.getLocalRotation().fromAngleAxis(-FastMath.PI/2, Vector3f.UNIT_X);