Problem loading model (.3DS)

Hello, other models do load that was supplied with the jME framework.



However, when I tried to load a quick model I made in 3ds max as a test, (just a 128x128x128 untextured box)

I get an error.



I have this code:

try {

            MaxToJme C1=new MaxToJme();

            ByteArrayOutputStream BO=new ByteArrayOutputStream();

            URL maxFile=Terrain3D.class.getClassLoader().getResource("images/box_model.3DS");

            C1.convert(new BufferedInputStream(maxFile.openStream()),BO);

            Node r = (Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));

            r.getController(0).setRepeatType(Controller.RT_WRAP);

            r.setLocalScale(.1f);

            if (r.getChild(0).getControllers().size()!=0)

                r.getChild(0).getController(0).setSpeed(20);

            Quaternion temp=new Quaternion();

            temp.fromAngleAxis(FastMath.PI/2,new Vector3f(-1,0,0));

            r.setLocalRotation(temp);

            r.setLocalTranslation(new Vector3f(0,3,0));

            scene.attachChild®;

        } catch (IOException e) {

            e.printStackTrace();

        }



But it aint work, I'm new to modelling, so as a test i wanted to make a test and try to upload it, not sure if its my code or my model, help!





The compiler error… the res selector starts, i hit enter, screen goes black, then it exits and says this error in console:

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

at java.util.ArrayList.RangeCheck(ArrayList.java:547)

at java.util.ArrayList.get(ArrayList.java:322)

at com.jme.scene.Spatial.getController(Spatial.java:183)

at cosmic3d_demo.Terrain3D.buildTerrain(Terrain3D.java:592)

at cosmic3d_demo.Terrain3D.initGame(Terrain3D.java:341)

at com.jme.app.BaseGame.start(BaseGame.java:56)

at cosmic3d_demo.Terrain3D.main(Terrain3D.java:88)

This:


            r.getController(0).setRepeatType(Controller.RT_WRAP);
            r.setLocalScale(.1f);
            if (r.getChild(0).getControllers().size()!=0)
                r.getChild(0).getController(0).setSpeed(20);
            Quaternion temp=new Quaternion();
            temp.fromAngleAxis(FastMath.PI/2,new Vector3f(-1,0,0));
            r.setLocalRotation(temp);
            r.setLocalTranslation(new Vector3f(0,3,0));


Does not apply to all models obviously. Remove these lines (and probably try to understand them).

ok it works thanx