Hello,
does anyone know this error? It occurs if I add a ParticleEmitter. Particles are created and fly but after some time I get this error…
java.lang.IllegalStateException: Scene graph must be updated before checking collision
at com.jme3.scene.Geometry.collideWith(Geometry.java:225)
at com.jme3.scene.Node.collideWith(Node.java:498)
at com.jme3.scene.Node.collideWith(Node.java:498)
at at.netcrystals.praxiteles.jme3.windows.PraxitelesSimpleApplication$1.onAction(PraxitelesSimpleApplication.java:132)
at com.jme3.input.InputManager.invokeActions(InputManager.java:140)
at com.jme3.input.InputManager.onMouseButtonEvent(InputManager.java:301)
at com.jme3.input.lwjgl.LwjglMouseInput.update(LwjglMouseInput.java:106)
at com.jme3.input.InputManager.update(InputManager.java:428)
at com.jme3.app.Application.update(Application.java:448)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:195)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:144)
at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:198)
[catch] at java.lang.Thread.run(Thread.java:619)
INFO [com.jme3.system.lwjgl.LwjglDisplay]: EDT: Sending re-init request…
Thanks,
Equi
The problem is what the error says: The scenegraph has to be updated. Do a rootNode.updateGeometricState() before picking.
I am getting the same exception, and it is from a picking collision test (as noted above) which I’m doing as per examples, something like:
[java]
public void onMouseMotionEvent(MouseMotionEvent arg0) {
Geometry n;
Vector2f mouseCoords = new Vector2f(arg0.getX(), arg0.getY());
Ray mouseRay = new Ray(cam.getWorldCoordinates(mouseCoords, 0),
cam.getWorldCoordinates(mouseCoords, 1).subtractLocal(
cam.getWorldCoordinates(mouseCoords, 0)).normalizeLocal());
rayResults = new CollisionResults();
collidables.collideWith(mouseRay, rayResults);
…
[/java]
the exception seems to occur only sometimes when I add a new object to the scene graph. Wouldn’t calling rootNode.updateGeometricState() on every mousemotionevent be really bad for performance? any other suggestions?
as a side note, I really wish the mouse coordinates were carried in the MouseButtonEvent too, the data is available in both MouseInput implementations already, so for simple cases where a mouseover isn’t required it would make things just that little bit simpler.
thanks
Hello,
as far as I know you have to call rootNode.updateGeometricState() there is no other way, or I didn’t find one till now.
Regards,
Equi