I’m a fairly new at working with BabylonJS and I’m working with panoramic shots that a user can use mouse or touch controls to look around the scene. I noticed that the ArchRotateCamera has a property named invertRotation, which should make the controls for the camera feel ‘natural’ or something more akin to google maps camera controls. However, when I set this property, I don’t see any changes in the rotating behavior when dragging my mouse across the screen. Am I using this property correctly, or is there something else I need to add before the inversion will work?
Here is an example playground based on the sample Photodome code where I’ve just added the property to the camera prior to attachment: Playground
This is an interesting catch!
The thought behind this feature is not for the arc rotate, but more for the universal/free camera, though the ArcRotateCamera is also a TargetCamera, and it should therefore be supported there as well.
I am pinging @PolygonalSun, our camera-input-genius, to fix that when he is back. Until then, here is a solution -
Invert ArcRotateCamera | Babylon.js Playground (babylonjs.com)
Multiply The angular sensibility in -1 will reverse the rotation.
Oh, that’s kind of weird if you think that the property invertRotation does not work. It’s still a nice trick. I checked it and it definitely works.
Yes, this is exactly the behavior that I was looking for, thank you! I figured there was just a different thinking for the implementation. Glad to know I was able to discover something interesting.
The invertRotation flag is used primarily with FreeCamera as FreeCamera is the one that uses the cameraRotation Vector for handling inertial rotation. The ArcRotateCamera uses different functionality but I do feel like the invertRotation flag should still work with it. I can reply when I have a PR adding this matching functionality.