Hi community. We love the ArcRotateCamera in our project, but often the users look ‘down’ on our models and this is, where it gets difficult.
When you look at this:
Now, start to rotate the scene with small mouse movements and the rotation very often gets weird and changes direction as long as we keep on looking down.
What would be a good way to improve this experience? Do I have to write a new camera or are these simply the mathematical limits of this camera type?
I think you need to avoid Math.PI to target with the camera. I sort of remember something around this.
I suppose a tiny-offset on the cam position and target should make things better (if I understand your problem correctly)
My suggestion is to change the implementation of the onTouch function to take the camera’s beta into account when changing the alpha. So if you are flipped, also flip the value that is added to the alpha offset.
I commented only for testing. You can reinstate them and then, you can also lower the values of offset to make it more of a top-down view… but then, as I said, I believe the change on pointer is still cleaner for a fix. Your choice
Edit: Did you say ‘null’, didn’t realize that sorry. What does this stand for?
Thinking about it a little more - you don’t want to always switch when flipped, just when you are flipping DURING a movement. So you shoud:
detect when a camera orientation event started
Track the changes in beta
during this mode, the onTouch function should flip its behavior ONLY when dragging moved from one mode to the other (happens in beta = 0 and beta = Math.PI).
Hi again, I just learned, that turning off the inertia in the onTouch pointer, the flipping does no longer occur - rotations above the zenith work smoothly. You can see that clearly in this playground:
Change the comments from line 198 and following. Does that mean, I have to implement my own inertia methods?
To provoke the flipping just rotate with the mouse by moving diagonally over the scene, so that the beta changes from one side to the other. w/o inertia the rotation is fine.