The ArcRotateCameraKeyboardMoveInput has no option for make the default keys events (up, down, left, right) to pan the camera instead of rotate it, like when you pressed Ctrl + move keys (it activates panning).
There is a _ctrlPressed variable on the object but can’t be setted, because it will be updated when pressed Ctrl on scene.
Is there a way to make the default movement of the camera, with the direction keys, will be panning instead of rotation?
I’d love an arc rotate camera where you could swap between rotate as pimary and pan as primary easily. Is this something that’s supported yet or could be considered as an option?
Currently, arcRotateCamera.attachControl takes a useCtrlForPanning option that defaults to true and leads to rotation as default motion and panning as secondary option (ctrl pressed).
I’d like to propose adding one more option that would default to false and would swaps the 2, so a user can easily switch to pan as default and rotate when ctrl is pressed. This would impact both arcRotateCameraKeyboardMoveInput and arcRotateCameraPointersInput. This could be useful for some setups (mine is consistency between a 3D viewer and a map viewer). It could also let developers build keyboard-less experiences where a user can press a button to switch between panning and rotating.
I don’t mind trying my hand at a PR, although i’m not super familiar with the codebase and may need some pointers. And if there is a better way to do this, let me know.
my only concern is that having 2 parameters which are not mutually exclusive may get confusing – what if both are set to true, what behavior does ctrl invoke ?
we could perhaps add a setting which can be enabled ontop of useCtrlForPanning – where if useCtrlForPanning is true (ctrl pans, regular rotates) but if false, it swaps (ctrl rotates, regular pans)
@amoebachant is out of office, once he returns we will discuss and recommend a solution or create PR to solve
And @georgie I’m 100% with you on that, i was wondering what was the best approach as well. I feel it’s almost more of an English and naming problem (plus clear documentation) than a technical one.
I noted that useCtrlForPanning default to true and can be set to false to disable panning altogether. And we need to keep backward compatibility. So there are 3 possible behaviors and we’re forced to keep one boolean setting. I see 2 approaches:
add swapPanAndRotate option conditioned by useCtrlForPanning
That’s much better yes. I didn’t realize we could rename the argument while maintaining backward compatibility. I thought it was a single object argument with named parameters.
Thanks for the reply @georgie. I thought @Joe_Kerr proposed an API design for the suggested changes that handles backward compat. I didn’t think this API exists as of today.
@georgie@Joe_Kerr@tibotiber This is exactly the area that I am focused on. It is irritating. Is it possible to have a dropdown of the different Camera types and the options for each? Just asked AI how to replace it. The response does seem off - incorrect:
“how to change babylonjs sandbox camera“ How to change babylonjs sandbox camera
To change the Babylon.js sandbox camera, you can follow these steps:
Set the active camera: Use the scene.activeCamera property to set the camera you want to use in the scene. For example, scene.activeCamera = myCamera;.
Attach the camera to the canvas: Use the attachControl method to attach the active camera to the canvas. This method takes parameters like canvas, noPreventDefault, and scene.activeCamera.attachControl(canvas, true);.
Ah yes I now see that it is a proposed change not a reference to existing API - my apologies.
Yes @amoebachant and I will discuss API changes to make after the 9.0 release! Can address this alongside the changes to introduce framerate independent movement to camera
Hi all, this work will be released after the 9.0 release - there has been a lot of feedback around camera / inputs so i want to tackle all together into a more configurable system, thank you for the feedback and will keep you updated as work evolves!