Problems with Camera when resizing the JMECanvas

Hi,



I'm working on a game that has a JMECanvas integrated in a Swing application. I noticed that when I resize the application window (and with that also the JMECanvas of course), the camera settings are completely wrong after that. With wrong camera settings I mean that picking does not work properly anymore and turning myself and looking up and down is also wrong. For picking I use a class NormalKeyboardHandler that extends InputHandler where I initialize an object KeySelectAction (extends InputActionInterface) with the current camera object. In the latter class I have the following method for picking:


public void performAction(InputActionEvent evt) {
      
      Ray selectRay = new Ray(cam.getLocation(), cam.getDirection());
      pr.clear();
      rootNode.findPick(selectRay, pr);
      
      if(pr.getNumber() > 1 && pr.getPickData(1).getDistance() < productPickDistance){
         ProductModelNode node = getModelNode(pr.getPickData(1).getTargetMesh().getParentGeom());
         if(node != null)
            selectAction.performAction(node);         
      }
}




In RenParticelEditor I have seen that the author always "reinizializes" the frustum when the canvas is getting resized:


protected void doResize() {
        if (impl != null) {
            impl.resizeCanvas(glCanvas.getWidth(), glCanvas.getHeight());
            if (impl.getCamera() != null) {
                Callable<?> exe = new Callable() {
                    public Object call() {
                        impl.getCamera().setFrustumPerspective(
                                45.0f,
                                (float) glCanvas.getWidth()
                                        / (float) glCanvas.getHeight(), 1,
                                10000);
                        return null;
                    }
                };
                GameTaskQueueManager.getManager()
                        .getQueue(GameTaskQueue.RENDER).enqueue(exe);
            }
        }
}




Do I need to do something like that also for the camera so that after a canvas resize the renderer does know that the canvas size has changed?

Any help would be much appreciated.

Thanks,

Michael