I just checked out the latest jme 2.0 code from svn and tried running the TestTurretControl. I got the following exception:
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:370)
at jmetest.ogrexml.TestTurretControl.setupTurretControl(TestTurretControl.java:156)
at jmetest.ogrexml.TestTurretControl.simpleInitGame(TestTurretControl.java:169)
at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:544)
at com.jme.app.BaseGame.start(BaseGame.java:74)
at jmetest.ogrexml.TestTurretControl.main(TestTurretControl.java:69)
Anyone get this problem?
For some reason the loader is failing to find the Turret-Armature.skeleton.xml file which results in no controller being loaded into the turret model. Is there something special I need to do to my eclipse build path in order for this to work?
This problem seems to be completely related to the classloader. I replaced the following lines:
URL matURL = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_TEXTURE, matUrlString);
URL meshURL = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_MODEL, turretMeshUrlString);
with
URL matURL = TestTurretControl.class.getResource(matUrlString);
URL meshURL = TestTurretControl.class.getResource(turretMeshUrlString);
and meshURL is always null. So I'm not able to even get a URL to the Turret.mesh.xml file! The material file is loading fine however. Very strange. If I rename Turret.mesh.xml to Turret1.material then it will be found by the class loader. Has anyone experienced this before?
My eclipse workspace was corrupt somehow. I created a new workspace, checkout out jme 2.0 again, and everything works fine.