Jump to content

Disable camera zooming for specific group


alphard
 Share

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!

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

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

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

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

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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