In a MilkshapeASCIIModel that I’ve been able to load reliably, I’ve added a simple animation where one piece of it rotates. There are 360 frame and 1 joint.
When loading the model:
MilkshapeASCIIModel modelToLoad = new MilkshapeASCIIModel
(entityIdString);
modelToLoad.load(fileToLoad.toURL(),"…/textures");
DeformationJointController modelToLoadJointController =
(DeformationJointController)modelToLoad.getAnimationController();
modelToLoadJointController.setupJointAnimations();
modelToLoad.addController(modelToLoadJointController);
I get the following error:
INFO: Node created.
java.lang.ArrayIndexOutOfBoundsException: 4872
at com.jme.animation.DeformationJointController.update(Unknown Source)
at com.jme.scene.Spatial.updateWorldData(Unknown Source)
at com.jme.scene.Node.updateWorldData(Unknown Source)
at com.jme.scene.Spatial.updateGeometricState(Unknown Source)
at com.jme.scene.Node.updateWorldData(Unknown Source)
at ZSMissionOverviewNoFrames.ZSMissionOverview.update(ZSMissionOverview.java:46)
at com.jme.app.SimpleGame.start(Unknown Source)
at ZSMissionOverviewNoFrames.ZSMissionOverview.main(ZSMissionOverview.java:40)
Apr 15, 2004 4:05:44 PM com.jme.app.SimpleGame start
INFO: Application ending.
Are there any other steps I missed to get a MilkshapeASCIIModel animation to play in JME?
Thanks.
Lynn
MilkshapeASCIIModel modelToLoad = new MilkshapeASCIIModel
(entityIdString);
modelToLoad.load(fileToLoad.toURL(),"…/textures");
alone should load the animations. You should not require a call to setup the deformation joint controller.
your code:
DeformationJointController modelToLoadJointController =
(DeformationJointController)modelToLoad.getAnimationController();
modelToLoadJointController.setupJointAnimations();
modelToLoad.addController(modelToLoadJointController);
was building an empty controller than replacing the filled controller. So when animation started, the array had zero elements.
I get the same error when only loading the model:
modelToLoad = new MilkshapeASCIIModel(entityIdString);
modelToLoad.load(fileToLoad.toURL(),"…/textures");
java.lang.ArrayIndexOutOfBoundsException: 4872
at com.jme.animation.DeformationJointController.update(Unknown Source)
at com.jme.scene.Spatial.updateWorldData(Unknown Source)
at com.jme.scene.Node.updateWorldData(Unknown Source)
at com.jme.scene.Spatial.updateGeometricState(Unknown Source)
at com.jme.scene.Node.updateWorldData(Unknown Source)
at com.jme.scene.Spatial.updateGeometricState(Unknown Source)
at com.jme.scene.Node.updateWorldData(Unknown Source)
at ZSMissionOverview.ZSMOMainScene.update(ZSMOMainScene.java:441)
at ZSMissionOverview.ZSMOFrame.handleInput(ZSMOFrame.java:264)
at com.jme.widget.WidgetAbstractFrame.handleInput(Unknown Source)
at ZSMissionOverview.ZSMO.update(ZSMO.java:43)
at com.jme.app.FixedFramerateGame.start(Unknown Source)
at ZSMissionOverview.ZSMO.main(ZSMO.java:38)
Apr 16, 2004 7:47:51 AM com.jme.app.FixedFramerateGame start
INFO: Application ending.
I may back off to a simpler model as a test case. Let me know if you have something I should try.
Thanks.
Lynn
I had some vertices that were not assigned to a joint - everything seems to be working fine now.
Thanks.
Lynn
You do bring up an interesting case. Your model worked fine in Milkshape, but crashed in jME. I guess we need to do a little work to make sure it can load models that have little "quirks" like that.