When action button is pressed a partial emitter is created and then it is attached to the mainNode, which is then attached to the rootNode.(this is due to the water processor).
But when I attached this code, the following error appears.
java.lang.IllegalStateException: Scene graph is not properly updated for rendering.
Make sure scene graph state was not changed after
rootNode.updateGeometricState() call.
Problem spatial name: null
at com.jme3.scene.Spatial.checkCulling(Spatial.java:227)
at com.jme3.renderer.RenderManager.renderScene(RenderManager.java:506)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:706)
at com.jme3.renderer.RenderManager.render(RenderManager.java:733)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:216)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:144)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:141)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:198)
at java.lang.Thread.run(Thread.java:619)
But If I attached the particle emitter directly to the rootNode, this problem goes away. But, i want to attach it to the mainNode.
I have the following two line at the start of the simpleUpdate function,(i am using ray casting to determine on which object the player is standing)
[java] rootNode.updateLogicalState(tpf);
rootNode.updateGeometricState();[/java]
If I add [java]mainNode.updateGeometricState();[/java] after the particle emitter is attached to the mainNode, then the following error appears
java.lang.NullPointerException: Geometry: Emitter has null mesh
at com.jme3.scene.Geometry.updateWorldBound(Geometry.java:180)
at com.jme3.scene.Spatial.updateGeometricState(Spatial.java:647)
at com.jme3.scene.Node.updateGeometricState(Node.java:185)
at mygame.Main.throwFireball(Main.java:465)
at mygame.Main$3.onAction(Main.java:418)
at com.jme3.input.InputManager.invokeActions(InputManager.java:145)
at com.jme3.input.InputManager.onMouseButtonEvent(InputManager.java:337)
at com.jme3.input.lwjgl.LwjglMouseInput.update(LwjglMouseInput.java:106)
at com.jme3.input.InputManager.update(InputManager.java:486)
at com.jme3.app.Application.update(Application.java:448)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:194)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:144)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:141)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:198)
at java.lang.Thread.run(Thread.java:619)