Hi, I currently have a arcRotateCamera setup in orthographic mode that zooms by manually setting the orthoLeft, orthoRight, orthoTop and orthoBottom properties on the camera object. This works fine, however I’d like it to zoom where the camera is rather than the centre of the screen. I’m pretty new to the 3D programming world and hence not 100% sure how I would even start to go about accomplishing that so any direction would be great.
For reference, this is roughly the code I wrote to zoom(actually broken up into multiple functions):
const delta = (Math.max(-1, Math.min(1, (event.wheelDelta || -event.detail)))) * 1.5; const zoomingOut = delta < 0; // limit zooming in to no less than 3 units. if (!zoomingOut && Math.abs(camera.orthoLeft) <= 3) return; camera.orthoLeft += delta; camera.orthoRight -= delta; const ratio = canvas.height / canvas.width; camera.orthoTop = camera.orthoRight * ratio; camera.orthoBottom = camera.orthoLeft * ratio; // decrease pan sensitivity the closer the zoom level. camera.panningSensibility = 6250 / Math.abs(camera.orthoLeft);