ArcRotateCamera Pan and Zoom sensitivity

Hi all,

I am having trouble getting pan and zoom under control using ArcRotateCamera.
Ideally, I’d like to have the same behaviour I can get with ThreeJS or Sketchfab.

I created the same scene in BabylonJS, ThreeJS and Sketchfab (links see below).
This screenscapture hopefully visualises the issue:

BabylonJS PG:
https://playground.babylonjs.com/#WGZLGJ#5803
ThreeJS:
https://jsfiddle.net/oliverxyz/0kLzmh29/1/
Sketchfab:
https://sketchfab.com/3d-models/venus-911e21e7518a4322886fb96b479b7be6

Pan:
ThreeJs and Sketchfab both seem to implement ‘screen space panning’.
Regardless of camera radius, the object is pretty much where the mouse is during pan.

Zoom:
Mousewheel sensitity seems to adjust based on camera radius.
I can get very close to the mesh in ThreeJS and Sketchfab without a problem.

What would be the best approach for the same behaviour in BabylonJS?
I was thinking using onAfterCameraRenderObservable to update panningSensibility and wheelPrecision based on camera radius, but maybe there is a working out-of-the-box method.

Thanks!

cc @PolygonalSun our input guru :slight_smile:

Thanks @sebavan!
so far, I got the mousewheel sensitivity under control with

camera.wheelDeltaPercentage = 0.01;
1 Like

Unfortunately, there is no out-of-the-box way to accomplish this in BJS but your idea to update based on radius would work. Here’s a quick example demonstrating this: Proportional Panning/Zoom Speed | Babylon.js Playground (babylonjs.com)

1 Like

I love this community :smiley:
Thanks @PolygonalSun, this is the behaviour I am looking for. Controls feel really good. Will try it with different scene scales.

1 Like

Reporting back with more info on scene scale:
At a panningSensibility of around 7000 (small camera radius), panning gets sometimes stuck, or suddenly decelerates (Video and PG below).

Which brings me to the question if BabylonJS prefers large scenes and one should try to avoid small camera radiuses.

You can see the demo file’s scale in the screenshot. It is pretty much real-world scale at 1 BlenderUnit === 1 Meter.

You can see panning getting stuck in the video (when getting really close to the mesh), or try it in the PG:

I feel like a larger scale scene will play nicer with zooming and movement than a smaller scale one. There is something odd about that behavior though. Have you tried doing anything to adjust the camera’s inertia value?

I have not changed the cameras inertia.
In fact, the video above was taken from the PG I posted.

And in there, all adjustments to the ArcRotateCamera are:
.minZ .wheelPrecision .panningSensibility.

I tested the PG with Chrome and Firefox and both have the same issue