How to restrict camera movement only to panning

Hello,
what is the best way to restrict camera movement in a way that only enables panning,
meaning no rotation just vertical and horizontal movement and zooming?
Do I need a different camera then the ArcRotateCamera I am currently using, or is this possible with this one as well?
Thanks

Maybe try using the Free camera, then do not attach the camera’s controls to the canvas but instead use some custom logic.

You can prevent panning by setting the appropriate property like so


camera.panningSensibility = 0;

While there is the special section in the docs about Customizing Camera Inputs | Babylon.js Documentation here is simple example of ArcRotate camera where only zooming (mouse wheel) is enabled - https://playground.babylonjs.com/#SRZRWV#566

You may also set lower and upper limits for alpha and beta values of ArcRotate camera. Here is the previous example with beta limits - https://playground.babylonjs.com/#SRZRWV#567

1 Like

I believe ‘panning’ refers to the horizontal and vertical move (not zoom or radius/distance). I also think an arc rotate camera might just not be the best cam type to allow only panning, since the arc rotate camera is (as per its name) essentially made to rotate around a point/object. Now. it’s still possible to restrict all of alpha,beta and radius and only allow panning (also setting origin and offset). But, you could also choose to use a multicam approach, where the camera would switch to a free/custom cam when in this interaction mode (of panning only).

1 Like

Thanks dear people,
yes, i was using “panning” as in “strafing” in video game terms.
so only move left / right or up / down.
I guessed that the arc rotate camera might be the wrong tool for the job as its name suggests.
Will have to look into the free camera

1 Like