Error: Missing indices on geometry object: null ["SOLVED"]

Hey guys, I am trying to load models into my game and I successfully load the gun model that I use into the game. I am trying to load the same model as as enemy (i am working on making the other model but for now the gun model will be my enemies). The game starts with no errors but when i look around for my enemies they do not appear and the output is "SEVERE: missing indices on geometry object: null (Alien)". Alien being my enemy. The model loading code is precisely the same.

    public Node makeShotgun()
    {
        Md3ToJme md3tojme = new Md3ToJme();  //the converter
        Node modelNode = null; //Where to dump mesh.
        ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); //For loading the raw file

        // File Path for the model (dump file in toplevel of classpath)
        URL url = BasicGame.class.getClassLoader().getResource("models/shotgun.md3");

        InputStream is=null;
        try {
           is=url.openStream();
        } catch(Exception err)  {
           System.out.println("Could not open Model file: "+err);
        }
        try {

            // Converts the file into a jme usable file
            md3tojme.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
            modelNode = (Node)binaryImporter.load(in);
            modelNode.updateRenderState();
        } catch(Exception err)  {
            System.out.println("Error loading md3 model:"+err);
        }

        //attach node to scene graph
     
        return modelNode;
    }



Has anyone received this error?

I apologize if i haven't included necessary information, it has been a while since i've posted.

let me know any thoughts or questions you have, thank you. :D

i'm probably not telling anything new but it happens when the TriMeshs IndexBufer is null:


            IntBuffer indices = tris.getIndexBuffer();
            if (indices == null) {
                logger.severe("missing indices on geometry object: "
                        + tris.toString());



Maybe check that its not null after loading the model.

Thank you. I will keep looking at it, haven't figured it out yet.

I changed the Alien class to extend Node rather than TriMesh and I no longer get the Missing indices error. However they still do not show up…

I successfully load the gun model that I use into the game


Does this mean you once loaded the model successfully (f.e. for your player)?

If not: Have you tested this in an empty rootNode (a TestClass)? I had trouble in loading a model because its translation was wrong. Perhaps the thing is just inside the floor or something.

Posting the code in which you attach the Node to the scenegraph could help. Perhaps the error is in there.

I have a model of a shotgun that is attached to the node that i control and therefore it looks like an FPS gun. It loads successfully every time I start the game.

This is the code for loading my model:

public Node makeAlien()
    {
        Md3ToJme md3tojme = new Md3ToJme();  //the converter
        Node modelNode = null; //Where to dump mesh.
        ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); //For loading the raw file

        // File Path for the model (dump file in toplevel of classpath)
        URL url = BasicGame.class.getClassLoader().getResource(locString);

        InputStream is=null;
        try {
           is=url.openStream();
        } catch(Exception err)  {
           System.out.println("Could not open Model file: "+err);
        }
        try {

            // Converts the file into a jme usable file
            md3tojme.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
            modelNode = (Node)binaryImporter.load(in);
            modelNode.updateRenderState();
        } catch(Exception err)  {
            System.out.println("Error loading md3 model:"+err);
        }

        //attach node to scene graph

        return modelNode;
    }


Fairly straightforward, it is identical to the shotgun loading. The only difference is the model that I load. I have already tried loading the shotgun model using the makeAlien() method to make sure it wasn't a model problem. The model is located in the right place and it is a good size. I set its local translation after I make it to a place that it should definitely show up. Plus, the models should be moving toward the player (different code that i made) so they would be coming up through the floor if they were under there.

What was the problem?

This issue has been more or less fixed. No need to continue on.

I moved the model making from a separate class into the main class. I know that it isn't a great "fix" but the program doesn't have to be that complex.