Scene graph is not properly updated for rendering Error

Hi guys.

Recently I have been experiencing the following error:

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalStateException: Scene graph is not properly updated for rendering.
State was changed after rootNode.updateGeometricState() call.
Make sure you do not modify the scene from another thread!
Problem spatial name: Root Node
at com.jme3.scene.Spatial.checkCulling(
at com.jme3.renderer.RenderManager.renderSubScene(
at com.jme3.renderer.RenderManager.renderScene(
at com.jme3.renderer.RenderManager.renderViewPort(
at com.jme3.renderer.RenderManager.render(
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(

It does not happen all the time, and when it does happen, is only when I try to use my “fly through feature”. Here’s the code for the fly through:

public void flyThrough(String fromLocation, final String toLocation, final boolean pathHighlight, boolean flyThrough) {

    PathFinder pf = new PathFinder(box.getXExtent(), box.getZExtent(), buildings);
    Vector3f fromVector;
    final Vector3f toVector = buildings.getBuildingJumpCoords(toLocation)[0];

    if (!(fromLocation.equals("Current"))) {

    fromVector = player.getPhysicsLocation();

    pf.setPath(fromVector, toVector);

    ArrayList<Vector3f> vList = pf.getPath();
    //cam.lookAt(vList.get(1), Vector3f.UNIT_Y);

    if (pathHighlight) {

    if (flyThrough) {
        path = new MotionPath();
        for (int i = 0; i < vList.size(); i++) {

        cam.lookAt(path.getWayPoint(1), Vector3f.UNIT_Y);

        camNode = new CameraNode("Motion cam", cam);


        cameraMotionControl = new MotionEvent(camNode, path);


        cameraMotionControl.setInitialDuration(path.getNbWayPoints() / 2);

        path.addListener(new MotionPathListener() {
            public void onWayPointReach(MotionEvent control, int wayPointIndex) {
                if (path.getNbWayPoints() == wayPointIndex + 1) {
                    if (pathHighlight) {

                    cam.lookAt(buildings.getBuildingJumpCoords(toLocation)[1], Vector3f.UNIT_Y);

                } else {



This method is called via an outside Java Dialog class (user clicks button which send information to this method). The code for the button in the other class:

[java]flyBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Robot robot = new Robot();
robot.mouseMove(cursorX, cursorY);
flyComboBoxT.getSelectedItem().toString(), pathH.isSelected(),
} catch (AWTException ex) {

You are changing the scene from the AWT thread by doing what you do (as the error message says).

Any ideas for a quick solution? - normally I would take the time to explore, but I am currently at my project demo fair, and the problem has only just started occurring!

You do the same you would do with invokeLater() when you would call Swing from another thread basically. You enqueue a Callable to the application via application.enqueue().

The GUI is a dialog, that is instantiated at run time (once) and then the visibility is changed. Would I use invokeLater when instantiating the GUI for the first time? I’ve never really used multi-threading so I’m not 100% sure on how to use it.

How would I use callable to pass parameters to an actual method?

Thanks for all your help! I’m in a dire situation right now :stuck_out_tongue:

Please just click that link, would you? You can basically copy-paste the code example at the very top, would have taken less time than this conversation already did.

I clicked the link, and have read through all the documentation. I just don’t understand how to apply that enqueue code to sending parameters to a method in the app…

Got it working, with:

[java] app.enqueue(new Callable() {
public Object call() throws Exception {
flyComboBoxT.getSelectedItem().toString(), pathH.isSelected(),

                        return null;

I also have this issue, and was really reluctant to start a thread because by searching I’ve seen you answer it a thousand times normen.

I think I am misunderstanding something. I have created a second viewport, and attached a scene (invNode = new Node(), I attachScene this)

“If you make changes only in Control.update(), AppState.update(), or SimpleApplication.simpleUpdate(), this will happen automatically.”

In my ‘public void simpleUpdate(float ptf)’ simple update loop, I update my inventory, which also happens to do:


This one line causes the error the OP has, when I comment it out it is gone. I double checked it was occuring in the simpleUpdate loop as you suggested with
System.out.println( Thread.currentThread() ); getting Thread[LWJGL Renderer Thread,5,main] in both my simpleUpdate loop, and in the method this problem occurs right before the crash

I thought this would be ok to update my scene for my second viewport/camera in the update loop?

(I also added
these as that was suggested elsewere in the forum)

I know I can fix it with the link provided, just curious as to why it doesn’t work as is

If you have a complete seperate scenegraph in a different viewport, you need to do stuff like that yourself, yes, as jme does not even know about it. it only takes care for stuff in the rootnode of the application for you.

1 Like

Ah ok, thanks empire