Custom camera with accurate panning

I have an ArcRotateCamera camera where I need accurate panning behavior.
I use panningSensibility and can pan; however, it is not accurate. How can I implement it accurately?
Is there any example to build a custom camera in Babylon from scratch?

From an implementation point of view, we like to convert the mouse screen point to an intersection point on the ground. From this logic, we like to calculate the difference between the ground’s start and endpoints. This is used to calculate the pan offset and apply it to the camera to perform the panning operation.

I think @PolygonalSun may have an example of a custom camera (or at least an existing camera being customized…).

1 Like

Hmm, doesn’t ‘camera.panningOriginTarget’ do the job?
When you say, it is not accurate, what do you mean exactly?
Is it the smoothness/speed? Or something else?


I actually wrote an article about custom camera inputs a while back: Looking at Custom Camera Inputs. One of the more common questions I see… | by Babylon.js | Medium. It dives a bit deeper into than the documentation and could help. Here’s also a basic custom implementation to work like the ArcRotateCamera: ArcRotatePointer Demo | Babylon.js Playground (


Thanks, @PolygonalSun, for the directions; I will take a look into it.

Hi @mawa,

In the ArcRotateCamera, when I zoom closer and far to the ground plane, the panning does not seem to consider the zoom factor from the ground plane. Currently, we are using panningSensibility for this, but the result is not very accurate for a different level of zoom.

I am building a geographical map rendering application, and you can think of panning similar to how it works in any standard 3D map application. When the user clicks on the ground surface and applies the mouse move operation, it should apply the displacement accurately based on the move rate when the camera is near or far from the ground.

Yes, I understand (and I agree). This part is not perfect. I actually posted a comment recently from another similar topic when I detected the panning is not the same if you start your click on a scene object or on the ‘root’. Looks like the speed/sensibility is different (which might be what you want, only thing, it’s done in a weird manner that makes it, as you say, inaccurate). Hopefully this can be improved later on.

1 Like