Jump to content

zoom to fit


Recommended Posts


I am playing around with the camera. Basicly i have huge map and when a player clicks on an item on the map i want the camera to zoom in and fit a certain area (lets call it a rectangle).

I had solve this problem in previous project in paper.js with some very complex calculations. But it is not easy because the camera needs to recenter while it moves and also you need to calculate zoom level that would fit the given area.

Also depending on the zoom level you are currently at, the zoom speed should be different.

Is there an easy way to do this in phaser 3?


I have already implemented a custom way for zooming with the mouse. I got it to be pretty smooth but not as smooth as with the SmoothedControlConfig using the keys (that doesnt support mouse for some reason :( ). Is there any work planned for this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...