Hi everyone,
I have just started using jME and have worked through some of the tutorials. Now I'm ready to start loading my own models, but I am running into some problems with loading Collada models and animations that have been converted from Maya. I'm using Maya version 7.0 and the ColladaMaya plugin from Feeling Software version 3.02. I have the latest version of jME from CVS, and the Collada test included there (the one with man.dae) works correctly. I'm using the instructions on the Wiki for exporting from Maya to Collada.
Here are links to my maya models and associated COLLADA files:
-
Maya lima bean (with animation)
-
LimaBean.dae
-
Maya dog (no animation)
-
TestDog3.dae
This is the code I am using (I am using TestColladaLoading.java as a basis):
//tell the importer to load the mob boss
ColladaImporter.load(mobboss, url, "model");
Node n = ColladaImporter.getModel();
n.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.PI/2, new Vector3f(1,0,0)));
//we can then retrieve the skin from the importer as well as the skeleton
//SkinNode sn = ColladaImporter.getSkinNode(ColladaImporter.getSkinNodeNames().get(0));
//Bone skel = ColladaImporter.getSkeleton(ColladaImporter.getSkeletonNames().get(0));
//clean up the importer as we are about to use it again.
ColladaImporter.cleanUp();
//rootNode.attachChild(sn);
//rootNode.attachChild(skel);
rootNode.attachChild(n);
rootNode.updateGeometricState(0, true);
Loading the model works for TestDog3.dae, although he just shows up as a ghostly figure (no materials, translucent). For the LimaBean, however, I get the following error:
Aug 1, 2007 2:51:48 PM com.jme.scene.Node attachChild
INFO: Child (VisualSceneNode) attached to this node (model)
java.lang.NullPointerException
at com.jme.animation.SkinNode.regenInfluenceOffsets(SkinNode.java:434)
at com.jme.animation.SkinNode.assignSkeletonBoneInfluences(SkinNode.java:411)
at com.jme.animation.SkinNode.updateGeometricState(SkinNode.java:317)
at com.jmex.model.collada.ColladaImporter.optimizeGeometry(ColladaImporter.java:768)
at com.jmex.model.collada.ColladaImporter.processCollada(ColladaImporter.java:745)
at com.jmex.model.collada.ColladaImporter.load(ColladaImporter.java:273)
at com.jmex.model.collada.ColladaImporter.load(ColladaImporter.java:253)
at jmetest.renderer.loader.TestColladaLoading.simpleInitGame(TestColladaLoading.java:77)
at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:497)
at com.jme.app.BaseGame.start(BaseGame.java:67)
at jmetest.renderer.loader.TestColladaLoading.main(TestColladaLoading.java:36)
Aug 1, 2007 2:51:48 PM com.jme.util.ErrorManager addError
WARNING: Error optimizing geometry - java.lang.NullPointerException
Aug 1, 2007 2:51:48 PM com.jme.scene.Node attachChild
INFO: Child (model) attached to this node (rootNode)
java.lang.NullPointerException
at com.jme.animation.SkinNode.regenInfluenceOffsets(SkinNode.java:434)
at com.jme.animation.SkinNode.assignSkeletonBoneInfluences(SkinNode.java:411)
at com.jme.animation.SkinNode.updateGeometricState(SkinNode.java:317)
at com.jme.scene.Node.updateWorldData(Node.java:396)
at com.jme.scene.Spatial.updateGeometricState(Spatial.java:330)
at com.jme.scene.Node.updateWorldData(Node.java:396)
at com.jme.scene.Spatial.updateGeometricState(Spatial.java:330)
at com.jme.scene.Node.updateWorldData(Node.java:396)
at com.jme.scene.Spatial.updateGeometricState(Spatial.java:330)
at com.jme.scene.Node.updateWorldData(Node.java:396)
at com.jme.scene.Spatial.updateGeometricState(Spatial.java:330)
at jmetest.renderer.loader.TestColladaLoading.simpleInitGame(TestColladaLoading.java:126)
at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:497)
at com.jme.app.BaseGame.start(BaseGame.java:67)
at jmetest.renderer.loader.TestColladaLoading.main(TestColladaLoading.java:36)
Aug 1, 2007 2:51:48 PM com.jme.app.BaseSimpleGame cleanup
INFO: Cleaning up resources.
Similarly, for any model I try that has animations in it, I get the same error. Also, if I try to load the skin and bones for the dog, I get a NullPointerException:
ug 1, 2007 3:32:59 PM com.jme.util.geom.GeometryTool minimizeVerts
INFO: batch: torsorebuiltSurfaceShape1: Batch 0 old: 1224 new: 268
java.lang.NullPointerException
at jmetest.renderer.loader.TestColladaLoading.simpleInitGame(TestColladaLoading.java:77)
at com.jme.app.BaseSimpleGame.initGame(BaseSimpleGame.java:497)
at com.jme.app.BaseGame.start(BaseGame.java:67)
at jmetest.renderer.loader.TestColladaLoading.main(TestColladaLoading.java:36)
Aug 1, 2007 3:32:59 PM com.jme.app.BaseSimpleGame cleanup
INFO: Cleaning up resources.
I have no idea if my problem is with the Maya -> Collada export or with my code, since I am new to both of these. For the dog, I did first convert the NURBS surfaces to triangles, since ColladaMaya doesn't support NURBS.
Any help would be much appreciated. Thank you in advance!
-Gillian