How to get the correct camera view world position

Hello,

I set a new scroll position and zoom level of a camera in scene.update() method. I need to find out where the camera view is exactly looking before the scene is render.
I tried to use camera.getWorldPoint(), but this does not return correct values (it ignores the new zoom level). I also tried to use camera.worldView, but this property is updated in the camera preRender step and I can’t find out how to call my own method after the camera preRender step and before the scene is rendered.

Have you tried this.cameras.main.worldView.x

The description of .worldView:

The World View is a Rectangle that defines the area of the ‘world’ the Camera is currently looking at. This factors in the Camera viewport size, zoom and scroll position and is updated in the Camera preRender step. If you have enabled Camera bounds the worldview will be clamped to those bounds accordingly. You can use it for culling or intersection checks.

It’s not kosher, but you can call, e.g.,

this.cameras.main.preRender(1);

to force it to update worldView.

Yes, I did. The problem is worldView is updated in the camera preRender method and I don’t know how to call my own method after the camera preRender() but before the scene is rendered.

The other way is to listen to the scene’s render event.

Unfortunately, by the time the scene’s render event is dispatched, the Scene will have already been rendered.

Call preRender() manually then.