Change zoom to mouse location to instead use right click

I would like to change input for the zoomToMouseLocation from wheel scroll to just a right click.

So, when you right click it instantly zooms to that location.

I would really prefer only the alpha and beta values of the camera to be affected instead of alpha, beta, target, and radius which seems to be the default.

here is a boiler plate code sort of…

Hi,

Let me see… For:

Hum, don’t think this has ever been implemented. Although suggested at some point.
I believe it still works only with the mouse-wheel?! Others to confirm. Here’s for my current ref:

Luckely, there are other ways :smiley:. The simple picking method will work AS LONG AS there’s a mesh (a plane, something, anything) to pick from. If you pick in just the blank scene, it’s not gonna work (because there’s no reference in the 3D space.

Here’s a quickly modified PG around this and below the reference link:


Next, for…

…and then what? what happens when you left-click, when you release click or if you attempt to use the mouse-wheel? For all of that, you need to

  1. define behavior
  2. customize inputs (checkout the doc starting here for more info on this part) - or check the forum for something like #mouse camera #inputs

Finally, for…

Well, I’m afraid this won’t work with the arcRotateCamera. This camera works with a target for a start with, so you just have to set a target. The distance/zoom is generally the radius. However you can also zoomIn or change the fov. However, changing the fov will also give a different perspective. Or providing you would actually select a mesh (and not a just a point), you could also attempt to go with the ‘camera.useFramingBehavior’ which will autozoom on the boundingBox of the selected mesh/target.

Well, I hope this will help a little and meanwhile, have a great sunday :sunglasses:

Edit: Just a quick adding. Admitting you would choose to pick a mesh instead of a point.

Just very roughly done, based on this PG, part of the doc. You would still need to add the custom mouse pointer input behavior.