Search the Community
Showing results for tags 'scrollfactor'.
Found 2 results
I am on WebGL mode, with a camera.zoom(7) and put some sprites to setScrollFactor(0) they disappear. So I had a look at the camera, in the top left corner of the game, it has a .scrollX/Y of high minus values. I already recalculated the world bounds and camera bounds, but that won't help. For me, this seems like a bug right now, but maybe I am again just missing something. I also noticed that the: this.camera.main.worldView.width // also height Is not set correctly, it is set some milliseconds after create is initiated, but if I log it directly in create it just holds the whole window width in pixels, not the zoomed calculation. Can someone else have a look at this? It's reproducible as far as I can see. Thanks in advance EDIT: as I see, this intended behavior, not a bug: setZoom( [value]) Set the zoom value of the Camera. Changing to a smaller value, such as 0.5, will cause the camera to 'zoom out'. Changing to a larger value, such as 2, will cause the camera to 'zoom in'. A value of 1 means 'no zoom' and is the default. Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering. https://photonstorm.github.io/phaser3-docs/Phaser.Cameras.Scene2D.Camera.html#setZoom__anchor But is there a way to get scrollFactor to work with a zoom? Reason: I got a camera permanently on zoom, which needs some UI displayed.
I'm using a callback function on the overlap method, but it's firing at the wrong time. After a bit of calculation/trial and error I worked out that it is firing where the sprite would have been if the scrollFactor of the sprite was the default setting of 1. I assume this is a bug? See demo on jsFiddle. Update: it also ignores the objects origin and assumes its origin is the default 0.5. I've updated the demo. Update 2: I'm now fairly certain this is not expected behaviour, so I've raised an issue on GitHub. Thanks, Josh