Hey, I’m working on a simple camera system and I’ve gotten most of the basics working. However I’m still running into (what I believe is called) gimball lock- when the empty the camera is parented to rotates >= 90 degrees, it gets confused and starts to rotate in the opposite direction.
I’m trying to write a simple Python script to limit the rotation to 89 degrees (and probably 1 degree in the other direction to keep the camera from molesting the ground plane) on its x-axis to avoid this issue, but I’m having trouble finding the correct function to do this. I’ve looked at the BGE API reference and found one function that returns a 3x3 matrix of an object’s orientation (which is lost on me, as I have no working knowledge of linear algebra) and another of which I don’t quite understand the description.
Is there any way to get the x-axis rotation directly, or do I have to use some linear algebra sorcery to obtain it from this matrix? (They didn’t teach this in high school; we were told to just “punch matrix problems into the calculator.” : / )
Thanks in advance for any insight into this problem Let me know if the Python script didn’t pack correctly.
EDIT:
I forgot to mention for anyone playing around with the .blend, the controls are:
Up Arrow: Look Up
Down Arrow Look Down
Left Arrow: Look Left
Right Arrow: Look Right
Q: Zoom In
A: Zoom Out
Attachments
camtest.blend (414 KB)