Hello everyone, I’m trying to come back to defold.
I decided to try the new camera component in my new project (Previously I used some old version of orthographic asset). And I have found out that it is impossible to use “Auto Fit” mode and zoom parameter. Is this intentional? How can I implement zoom in and zoom out for games, maybe some different options?
Yes. What Auto Fit will do is basically to adjust the “zoom” to always fit the entire area. You need to switch to FIXED to use the orthographic zoom:
Yes, this is intentional ![]()
In Auto Fit, Defold calculates the orthographic zoom automatically to fit the design resolution, so the manual zoom value is effectively ignored.
If you need zoom in/out during gameplay, use Fixed mode and change the camera zoom from script.
I understand that you act in best intentions but sadly with this restriction standard camera still unusable. Because I dont understand why for simple things like
- zoom in for a dialog time in towpdown JRPG
- enlarging match3 for one more row, because original row count was miss calculated
- ability to zoom in and out in RTS games
I have to dive in matrix stuff. And of cource I can copy original render script and skew it to my way, but it is stange that we still recommend to users to do they own camera staff. ![]()
I do not understand your concerns at all. Why would you need to “dive in matrix stuff”? You don’t need any of that. Set the camera to Fixed, then set/animate the Orthographic Zoom to a value of your liking.
I suppose your concern is with “to a value of your liking” because you don’t know how to calculate which zoom is required to get the camera to exactly encapsulate a rectangular area of your choice?
I’ll prepare an example ![]()
I cannot just set Fixed and zoom. I need to do something to bring the same autofit proportion first to my code because I want game to look the same on different devices. Then I can animate additional param that I will multiply to autofit zoom.
Ok. It is quite easy to replicate the behavior of ORTHO_MODE_AUTO_FIT and ORTHO_MODE_AUTO_COVER using the ORTHO_MODE_FIXED camera mode: