How to realize Panning on the X,Z-Plane with the ArcRotateCamera?

I have a Question about Panning with the ArcRotate Camera.

The behavior I want to achieve can be seen here:

I’d describe this as the default RTS camera behavior.

After some testing I have gotten panning along the x,z direction to somewhat work here:

with camera.panningAxis=new BABYLON.Vector3(1,0,1); doing the bulk of the work.

There are 2 Problems however:

  1. This does not work on the preview branch. It simply zooms instead of panning along z.
    Comparing the Preview and master branches I think this is due to the omission of one block:
    ArcRotateCamera Preview
    ArcRotateCamera in master
    The block in questions:

    if (!this.panningAxis.y) {
    this._transformedDirection.y = 0;

  2. While Panning in X Direction works, panning in Z Direction scales with the Beta of the camera.
    When looking straight down on the scene it basically cant be moved in Z Direction at all, while at ground-level it moves very fast. Ideally this movement would have the same speed as in the X-Direction.

Any Help is much appreciated.

Searching in playground is sometimes helpful :slight_smile:

Some results:

Sadly both those examples use
camera.panningAxis=new BABYLON.Vector3(1,1,0);
which just pans on the x,y axis and is from what i can tell the default behavior as removing the line doesn’t change anything.

When looking just for examples that set panningAxis i did find some examples for the usage with a Vector3(1,0,1), however(with the exception of those that don’t run at all) all of those show the exact same problematic behavior and difference between Versions 5.0 and 4.2.
Some examples of what I mean:

Zooms in 5.0 and pans in the same clunky way in 4.2 as described in the original post.

Thank you for your Help though. Playground search was very helpful in finding out if others encounter the same problem.

I hope the understanding about spherical panning brings you closer to your solution:

when i look at it closely. it doesn’t seem to be a question of camera position at all, but rather the shifting of the base. the camera is still on its position. nice to see if you drag a corner of the green ground: the cursor is still on the same spot on dragging… maybe you have to shift a bit the viewpoint of the problem to catch the solution.

Thank you again for the help. I have done some testing, and it seems that i will need to find a modifier to make sure that the camera target displacement is correct for the z axis from the view of the camera.
I’m still unsure about the difference in version 4.2 and 5.0 but i maybe the old behavior was bugged.
If I do figure it out ill post a solution here.

@PolygonalSun Can you have a look ?

Yeah, I can take a look