Sign in to follow this  
alphard

Disable camera zooming for specific group

Recommended Posts

Hi everyone!

I have the following problem.

I have several groups in my game: backgrounds, foregrounds, game objects, etc..

One of those groups is GUI group.

When the camera is zooming all the groups are zooming too.

Is there a way not to zoom this specific (GUI) group on camera zooming?

I tried to set fixedToCamera property, but it doesn't seem to consider zooming.

Thanks!

Share this post


Link to post
Share on other sites

Presumably you're using scaling and pivots to get the results? Zooming isn't a native feature of Phaser, so it has no comprehension of what to do otherwise in the event that you scale an object or one of its ancestors, it will just do the normal scene graph thing and scale it too.

Share this post


Link to post
Share on other sites
Thank you, lewster32. You are right, I am using scaling (game.camera.scale). Have you any ideas how to walk the problem around?

So far, I listened to the scale (say, S) change on update, and proportionally updated GUI group scale (1/S). But such a solution looks clumsy.

Share this post


Link to post
Share on other sites

The way I'd do this is to create two separate groups at the root of the display list, one for the UI and another for everything else which would scale/zoom, and then only scale the second group to produce the zoom effect. This way, because the UI group separate from the other group, it won't move or scale when the other does.

Share this post


Link to post
Share on other sites

Just to elaborate, this means you're scaling the group, not the camera - this will unfortunately introduce more work as you'll have to replicate the effects of the camera with a moving and scaling group... I think probably it may be easier in your case actually to take a look at what happens inside Phaser when you set fixedToCamera to true, and try to add in the scaling fix.

Share this post


Link to post
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.

Guest
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.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.