I make a human model by makehuman, and then export to .gltf file via the blender 2.8. Everything is OK in the JME SDK. The model is textured, animated and could load, play in the SDK. However, when I load the model by code in a very simplest test (load asset and then get AnimControl), it just could not find the AnimControl of the model. Even I convert .gltf to .j3o format (without any error reported), the same problem still exists.
Can you show the code where you “find” the animcontrol and a screenshot of the model tree in the SDK? It should have the same “path” as you see in the model tree in the SDK.
Which version of the SDK and which version of the engine?
Are you loading the model as an already converted .j3o in the engine or are you loading the gltf directly?
The reason I ask is because in newer versions of the engine (3.3+) it will use AnimComposer instead of AnimControl when loading from gltf directly.
The version of both SDK and engine is 3.2.4. I could loading the .gltf model directly by SDK. But even i convert it to .j3o and load .j3o file by code, it just could not get animControl.
When you load it in the SDK and look at it in the scene explorer, what controls does it have?
Given the description, now I think maybe you are not looking up the AnimControl correctly. This is the risk we take when we can’t see your code… we could be making wild shots in the dark when it’s something simple.
just please show code responsible for find Controls.
im 99% sure something is wrong there.
Or maybe you trully use 3.3 in game and didnt noticed ;p (who knows)
The model tree shown in SDK is:
The code I used to load model and animation is:
Node testModel = (Node) app.getAssetManager().loadModel("Models/xxx/xxx.gltf"); // before AnimControl animControl=testModel.getControl(AnimControl.class); System.out.println(animControl); // return null // after Geometry cube=Util.findGeom(testModel,"Cube.001"); AnimControl cubeAnimControl=cube.getControl(AnimControl.class); System.out.println(cubeAnimControl); // animation loaded System.out.println(cubeAnimControl.getAnimationNames());
In the “before” version, the system just returned null animation control loaded; in the “after” version, the animation was successfully loaded. It seems that if the animation if not the child of the loaded spatial directly, then I could not load it.
yes, it depends on many things. you always need to have proper Spatial to get control. (because model could have 2 different rigs with own controls)
you can also write yourself some method that will search childs for Controls.(if your models always have single AnimControl)