Animation pause when game paused

You mean BaseAppState and onEnable and onDisable, I think. :slight_smile:

Well itā€™s not available in 3.0.
but Iā€™d definitely use this in 3.1

but how do I make my own rootnode actualy renders on screen ?

viewPort.attachScene(rootNode); ?

also in update() I see:

        rootNode.updateLogicalState(tpf);
        guiNode.updateLogicalState(tpf);
        
        rootNode.updateGeometricState();
        guiNode.updateGeometricState();

is maintaining my own rootnode going to mess everything ?
do I have to override/rewrite update() too ?

yes exactly

No, it wonā€™t. The appā€™s rootNode will be updated, but since itā€™s empty it wonā€™t do nothing.
However your appState will update its own rootNode and it will work as it should.

Not the one of the app.
you have to implement the update method of the AppState though and update the appStateā€™s rootNode in it.

Trueā€¦ but AbstractAppState doesnā€™t manage enable/disable for youā€¦ so I was confused. It just has a raw flag and you have to manage ā€˜stateā€™ yourself. OP can always cut and paste BaseAppStateā€™s code to make their own, thoughā€¦ until 3.1.

I dont know why I get this error, since the node is updated in an apptsate update() function

State was changed after rootNode.updateGeometricState() call. 
Make sure you do not modify the scene from another thread!
Problem spatial name: myRootNode
    at com.jme3.scene.Spatial.checkCulling(Spatial.java:260)
    at com.jme3.renderer.RenderManager.renderSubScene(RenderManager.java:647)
    at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:640)
    at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:974)
    at com.jme3.renderer.RenderManager.render(RenderManager.java:1029)
    at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)

here MyAppState extends AbstractAppState and is attached with stateManager.attach(scenario);

public class ScenarioAppState extends MyAppState implements PhysicsCollisionListener,ActionListener
{
...

 @Override
    public void update(float tpf)
    {
        switch(state)
        {
            case RUN:
                rootNode.updateLogicalState(tpf);
                rootNode.updateGeometricState();
                break;
            case WAIT_FOR_PLAYER:break;
        }

ok I figured I had to add myrootnode appstate as the last one so update() was called after all other appstates modifying geometries

but I still get the error sometimes, not easy to track what is causing the issue

so I enqueued come parts of my code, so far so good

Do the updateGeometricState() in app stateā€™s render() method instead.

Note: this code is strangeā€¦ seems like you should just be setEnable(false/true) the app state to control this. update() only runs if isEnabled() returns true.

maybe I should put that updateLogicalState thing in another appstate devoted to that, so far it is in the appstate requesting the game to be paused and checking for ā€œenterā€ to be pressed to resume the game

btw I never understood the meaning of the render method ??

render() is called after all update()s are called. Thatā€™s it.

As to the other, if thatā€™s all your update() is doing then you could just remove everything but the updateLogicalState() and then enabling or disabling the state would be the same as setting it to RUN or WAIT. I donā€™t know why youā€™d want yet another state.

Else show us the whole state so we arenā€™t guessing.