Gimbal Lock Problem - OpenGL: Advanced Coding - Khronos Forums Trang chủ » Gimbal Lock Là Gì » Gimbal Lock Problem - OpenGL: Advanced Coding - Khronos Forums Có thể bạn quan tâm Gimbal Máy ảnh Cũ Gimbal Máy ảnh Dưới 3 Triệu Gimbal Máy ảnh Zhiyun Gimbal Mini Giá Rẻ Gimbal Nghĩa Là Gì Gimbal Lock Problem OpenGL OpenGL: Advanced Coding Aramil November 11, 2006, 8:12am 1 Hello again…okay, my next project is a 3D space combat almost-sim. The ship should be able to pitch and roll depending on the joystick positions. Unfortunately, I’m encountering a problem that I believe is called gimbal lock. I’ve heard that this can be corrected with quaternion math, but my math education isn’t advanced enough yet for me to understand this. Can anyone direct me to any useful libraries/engines/code snippets or techniques that wouldn’t be too complex? Thanks. Sv3nni November 11, 2006, 3:52pm 2 The Nebula device has a good math-lib. http://nebuladevice.cubik.org/ You can copy from there. Bob November 11, 2006, 11:58pm 3 Gimbal lock is not solved with quaternions. Gimbal lock is an effect of the rotation representation you use, not how you realize those rotations. So it’s just as easy to run into it with quaternions as with matrix rotations, and you can avoid it as easily with matrix rotations as with quaternions. The Gimbal lock is an effect of Euler angle rotations, and switching to quaternions, but preserving the underlaying Euler angle rotation system, will not eliminate the Gimbal lock problem. If you solve it with quaternions, you have solved it with matrix rotations also. What you have to do to avoid Gimbal lock is to not use Euler angles. Look into axis/angle rotation systems instead, in which case quaternions are useful. Also, but I’m not entirely sure, I don’t think you can ever run into the Gimbal lock problem by only using two euler angles. You need three angles to even have a chance. Rotate first angle by a certain amount so the two remaining rotation axes are the same and you lose one degree or freedom. With two rotation angles, you still have the remaining degree of freedom left for use. Aramil November 12, 2006, 5:46am 4 Okay…maybe my problem isn’t gimbal lock. I’ll describe it to you. So, you know that I want my ship to pitch and roll. Whenever my pitch is at zero degrees, my roll works perfectly. However, when I pitch down 90, my roll becomes yaw. I think I described my problem wrong…how can I fix this? yooyo November 12, 2006, 9:49am 5 Your ship have current orientation. Make additional rotation based on delta values from input device and compose it. Example: float oldJoyX, oldJoyY; mat4 CurrentShipMatrix; ... float x,y; ReadJoystick(&x,&y); // absolute values from -1 to 1 float dx = x- oldJoyX; float dy = y- oldJoyY; oldJoyX = x; oldJoyY = y; mat4 deltarot = BuildRotationMatrix(dx, dy); CurrentShipMatrix *= deltarot; You may need additional code to adjust rotation speed. Even more… you can use absolute values from joystick as delta values… when player pull or push joystic more, ship will rotate faster. Aramil November 13, 2006, 6:07am 6 Hmmm…what type of variable is “mat4”, and what’s “BuildRotationMatrix”? I understand what you’re getting at with how the rotation will increase with the joystick angle…I’m not sure how this can solve my problem; I don’t understand those types mentioned above. Could you please explain them, or where you got them? yooyo November 13, 2006, 7:49am 7 pfff… It’s a pseudocode. I suppose you already have your own math library. In short… mat4 is 4x4 matrix BuildRotationMatrix(roll, pitch) should build 4x4 matrix based on rool and pitch value. a = b is equal to a = a b Aramil November 13, 2006, 9:24am 8 Alright, got that far. a *= b is equal to a = a* b Lol, was that sarcasm? I’m assuming that “BuildRotationMatrix” is simply creating a 4x4 matrix and just inserting those roll and pitch values into the corresponding slots? Once I’ve build that new one, I just multiply the old matrix with the rotation one. dolf November 13, 2006, 10:10am 9 Originally posted by Aramil: So, you know that I want my ship to pitch and roll. Whenever my pitch is at zero degrees, my roll works perfectly. However, when I pitch down 90, my roll becomes yaw. I think I described my problem wrong…how can I fix this? What you describe here sounds a lot like you apply pitch and roll in the wrong order. yooyo November 13, 2006, 10:54am 10 @aramil: When you fly a space ship… your controls should be applyed relative from ship orientation. You can’t apply absolute rotations. Sarcasm… not… Since you didn’t know what is mat4 I was think it is better to explain multiplication too. Maybe im not precise enough… It was matrix multiplication, ie. matrix composition. Keep up good work! Aramil November 14, 2006, 7:12am 11 I can work with that stuff. Thanks! Từ khóa » Gimbal Lock Là Gì ĐỂ MỊ NÓI CHO MÀ NGHE: Gimbal Lock Trong Anim Maya Là Gì? Đặc ... Euler (gimbal Lock) Explained - YouTube Gimbal Là Gì? Cách Hoạt Động Của Gimbal - VJShop Gimbal Lock Là Gì - Nghĩa Của Từ Gimbal Lock Gimbal Lock Là Gì - Top Công Ty, địa điểm, Shop, Dịch Vụ Tại Bình ... Gimbal Là Gì Và Cách Thức Hoạt động Của Nó Gimbal Là Gì ? Phân Loại Và Tác Dụng Của Gimbal Gimbal Chống Rung Là Gì Và Hoạt động Ra Sao - Xóm Công Nghệ Maya에서 짐벌락(Gimbal Lock) 해결에 대한 사례 연구 GỠ RỐI CÁC LỖI THƯỜNG GẶP Ở GIMBAL - FlycamPro Gimbal Lock Problem - Unity Answers Báo Cáo Thực Tập-hệ Thống Imu Và Và Các Tính Toán Liên Quan