Camera zoom not respecting mask

Hello. I am working on a 2D game in cocos v2.3.4. I have just added a feature with a main camera to render my game elements and a secondary camera to render my UI so that the main camera can be zoomed without the UI moving. The problem is that now the final picture gets bigger in the game instead of staying within the defined size of the mask.

The heirarchy looks like this:

Canvas (mask)

Main Camera
UI Camera
Game Stuff

Everything else

I am zooming the camera by increasing the zoomRatio to 1.8.

I’ve read the relevant documentation and it seems like this should be working so I could use some help. Thanks

Are you able to show screenshots or mock-ups of what you expect to see, and what you’re actually seeing? A simple test project that reproduces what you’re seeing would also help.

I can’t show a screenshot since my company doesn’t allow it but I can try to create a little mock up. Basically we are creating mobile games so there should be a mask that is the size of the screen. This all worked great until I started messing with the camera. Now when it zooms, the background and game elements just get bigger and go outside the bounds of the “screen size”. The mask that would normally cut it off seems to be zooming as well or just being ignored.

A mock-up would be perfectly fine. If you can create a simple test project too, with the minimal amount of code required to display the problem, then that would be beneficial.

Also, the version of Cocos2d-x you are using is extremely old, and this specific issue you are experiencing may have been fixed in later versions. Are you able to test it out with Cocos2d-x v3.17.2+ or v4? Even writing a simple test case for yourself to see if it has been fixed, and if you find that it has, then you may be able to port the fix back to the version of Cocos2d-x you are using for your project.

I am unable to upgrade the version. I’m aware its ancient but its what my company uses with their current pipeline so its not an option.

Sorry, I didn’t mean upgrade your project to a newer version of Cocos2d-x. What I meant is write the minimal amount of code to reproduce the issue in a test project using Cocos2d-x v2.3.4, and then test that same code using a newer Cocos2d-x just to see if the issue has been fixed. That is assuming this is a problem with Cocos2d-x.

For the time being, posting a small test project that reproduces the issue would be the best way to help you with this, otherwise it’s just a guessing game for everyone involved. If you’re not able to create a small project with this issue, then hopefully someone else browsing this forum may have come across this before and can provide a solution.