I am working on the user inputs of a scene and wonder how to bind the panning of the arcRotateCamera to a global axis.
Imagine there is an object in the center of the scene and the camera should focus it all the time. The user should be able to pan along the y axis to set the camera target to the bottom or top of the object. But
You can test it in this pg: https://playground.babylonjs.com/#W3HQP7#3
Load the scene and rotate around the object. You can see that the camera is always targeted to the center of the object.
Load the scene, pan so the object is higher and rotate around the object. You can see that the object isn’t centered anymore.
The problem here is that panning doesn’t only adjust the y value of camera.target but also x & z. How am I able to keep x & z always 0?
My apporach is this, but it isn’t smooth & accurate: https://playground.babylonjs.com/#W3HQP7#4
It should simply behave like moving the object up and down but without moving the object but the camera.