Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Rotation Lock #490

Open
stoplime opened this issue Oct 13, 2020 · 1 comment
Open

Camera Rotation Lock #490

stoplime opened this issue Oct 13, 2020 · 1 comment

Comments

@stoplime
Copy link

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.

@mday299
Copy link

mday299 commented Nov 4, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants