I have been following the beginner tutorials in the wiki and got a bit stuck on the jMonkeyEngine 3 Tutorial (7) - Hello Animation :: jMonkeyEngine Docs one attempting to make the SkeletonDebugger work. After a while of tinkering with different things I managed to make it work by calling updateGeometricState() on the skeletonDebugger as a final step but I don’t understand why this worked or if am doing the correct thing.
So this is what I have (at the end of simpleInitApp, the rest of the code is exactly the same as the tutorial linked):
skeletonDebug = new SkeletonDebugger("skeleton", control.getSkeleton());
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Green);
mat.getAdditionalRenderState().setDepthTest(false);
skeletonDebug.setMaterial(mat);
player.attachChild(skeletonDebug);
skeletonDebug.updateGeometricState();
Could someone explain what is going on in updateGeometricState and if there is another thing am missing to make the skeleton debugger work?
I found this thread How do I make my skeleton visible? and replacing player for rootNode worked Why must the skeletonDebug be attached to the rootNode instead of to the player? My guess is that there is a difference between attaching a child to the rootNode vs attaching to a regular model which requires some additionalUpdate (whatever that means)
I’m not sure what’s going on with the difference between attaching to the scene root vs attaching to the player node - during scene update, both update the same way. If you need to resort to calling methods like updateGeometricState() you’re probably encountering the symptom of something else that’s wrong - that’s an internal engine method that you should almost never call yourself.
There’s no material difference between the root node and nodes further down in the scenegraph - as long as a node is attached, it will be updated by its parent.