Hi!
I needed to add an orthographic view to my project with zoom support. I am using an ArcRotateCamera. It is known that the orthographic mode doesn’t honor the arc camera’s radius property and one needs to alter the orthoXXX properties of the camera to zoom in or out the view.
I’ve found some solutions on the forum. All of these solutions uses mouse scroll-wheel events to mimic the zooming functionality of the arc camera.
I didn’t find these solutions good. You may alter the radius property in different ways, not with just the mousewheel.
So I came up with this solution. It is simply watching for changes of the radius property (even if the radius property doesn’t affect the view of the arc camera it reacts and changes according to camera inputs as if the camera was in perspective mode). As an addition you get lerping of the orthoXXXX values for free because the radius value is already lerped each frame so the zoom is smooth and honors all the parameters of the camera for example like the wheelDeltaPercentage which I used in my exampe to make the zooming slower.
If you want a 2D camera looking from above just disable beta rotation.
camera2d.upperBetaLimit = 0
camera2d.lowerBetaLimit = 0
Enjoy!
![]()
R.