Camera Rotation Lock
Opened this issue · 1 comments
Medium priority bug
Camera movement:
When the camera is in follow mode and the user tries to rotate the camera up above 90 degrees elevation angle(so that the camera will look down onto the following aircraft), the camera will flicker by rotating 180 degrees azimuth angle every frame. This effect also exists when the camera is rotated the other direction (camera looks up past 90 degrees). This has been tested on master branch: 5000d7e
It seems like the camera is trying to orient itself so that the down direction is in-line with the ground. While the user is rotating upwards the ground is rotated 180 degrees but the user can still go upwards and cause the 180 rotation to repeat every frame causing it to flicker.
One possible solution would be to limit when the user tries to rotate past 90 degrees to stop before the camera re-orients and rotates 180 degrees.
What you're describing is Gimbal Lock. This is what happens when you try to use Euler angles to represent rotations. There are ways around it:
https://www.cprogramming.com/tutorial/3d/quaternions.html
http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-17-quaternions/#how-do-i-create-a-quaternion-in-c-
https://www.youtube.com/watch?v=zjMuIxRvygQ
I don't think VTK addresses Gimbal lock, but I could be wrong.
Feel free to submit a PR that implements any of the above (or your own) method for dealing with Gimal lock.