body::applyTorque() gimbal lock

Post Reply
Zuka
Posts: 3
Joined: Mon Apr 04, 2011 9:51 pm

body::applyTorque() gimbal lock

Post by Zuka »

Is there any way to overcome this? I'd like to use quaternions, but this function only accepts Euler angles and I can't find a single viable workaround. I'd rather not dig into the Bullet source code, but if that's what I must do, I'll do it.

Also, I'm calling this several times per tick so a costly conversion from quaternions to Euler angles is... less than preferable.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: body::applyTorque() gimbal lock

Post by Erwin Coumans »

torque is a force vector, not angles. Bullet uses quaternions to represent the orientation of objects.

It is not clear what kind of gimbal lock you suffer. Can you provide a repro case?
Thanks,
Erwin
Zuka
Posts: 3
Joined: Mon Apr 04, 2011 9:51 pm

Re: body::applyTorque() gimbal lock

Post by Zuka »

:O That may be the issue then. I have a spaceship that I want to rotate responding to controls. I have yaw, pitch, and roll. It seems simple enough, but how would I do this? It seems that if the ship rotates in more than one axis, everything is wrong, just like what happens with gimbal lock.

[edit] Never mind. I believe I know what the problem is now (simple mistake of assuming it was local rotation)
Post Reply