I am currently writing my own graphical front end engine in openGL, on top of a Bullet physics simulation. I have successfully retrieved the world coordinates of the objects like so:
Code: Select all
spbody = body[k];
btT = spbody->getWorldTransform();
mbodypos = btT.getOrigin();
posis[lin ] = (float)(mbodypos.getX());
posis[lin+1] = (float)(mbodypos.getY());
posis[lin+2] = (float)(mbodypos.getZ());
But now I want to retrieve the rotations of this body, in such a way as to simplify the process in openGL during drawing. In openGL, built-in matrix operations can be performed, on an item-by-item basis during draw. Like so
Code: Select all
glPushMatrix();
glTranslatef(xcf, ycf, zcf ); // move item to position
glRotatef( 1. , 1.0f, 0.0f, 0.0f ); // Rotate by 1 radian around X-axis
glRotatef( 1. , 0.0f, 1.0f, 0.0f ); // Rotate by 1 radian around Y-axis.
glScalef( itemscale, itemscale, itemscale ); // item scale
ogl.DrawItem(n);
glPopMatrix();
This is not an openGL question. This is a question of, "what-do-I-do-after-getWorldTransform()"?? Seems like to convert to openGL, I will need to drill down into the rotation components of the rigid body. But how are those stored? As quaternions?