Zoom in/ Zoom out for orthographic view

Hi,
I’m trying to zoom in for an orthographic view, which is currently impossible. So would like to ask how I can achieve zoom in out on the orthographic view!

Just copy paste from another playground. Orthographic camera with edge renderer and transparency | Babylon.js Playground (babylonjs.com)

Getting this error:
deltaY does not exist on type ’ PointerEvent | WheelEvent’

I believe there has been some changes made lately on pointer events.
Delta does not seem to work the same for pointer events. Here is a post around this subject.
Though in your case and since it’s working in the PG, I’m wondering if it would not work by simply calling again on the var created for the observable; on line 29 of the above example PG posted by @Naznarok :

        wheelDelta = -(event.wheelDelta.deltaY || event.detail) * 60;

Can you try this? Else, you will probably need to modify according to the new behavior for pointer delta events for the camera.

Yes I have tried but still, it’s not working getting the same error for wheelDelta:
wheelDelta does not exist on type ’ PointerEvent | WheelEvent’

Does this work for you? What browser are you using?

The entire point in an orthographic view is that no matter what depth position your camera is at, the perspective has 0 impact so the default moving along Z techniques to zoom would not work.

In ortho views, the user is managing the full extends of the camera. You could then probably create it by listening to the mouse wheel events and reduce/extends your view area.

1 Like