For a game that I am developing I moved from Bullet physics to NVidia Physx. The problem that I have is the following. I used to have a translation from bullet's rigid body orientation quaternion to Front , Right and Up vector for each object on the screen. This was working fine but after I moved to Physx I noticed that there is only one quaternion in the transform of the object (probably representing rotation) and no orientation quaternion. Here is the code that I was using in Bullet to get the 3 vectors translated to Physx :
physx::PxQuat ori = mBody->getGlobalPose().q;
auto Orientation = glm::quat(ori.x, ori.y, ori.z, ori.w);
glm::quat qF = Orientation * glm::quat(0, 0, 0, 1) * glm::conjugate(Orientation);
glm::quat qUp = Orientation * glm::quat(0, 0, 1, 0) * glm::conjugate(Orientation);
front = { qF.x, qF.y, qF.z };
up = { qUp.x, qUp.y, qUp.z };
right = glm::normalize(glm::cross(front, up));
This apparently doesn't work for Physx. Is there another way to retrieve the 3 vectors from the rigid body ?
glm::quat()
is the real component (w) and which are the imaginary components (x, y z).glm::quat(ori.x, ori.y, ori.z, ori.w)
this says thew
component is last, but thislm::quat qF = Orientation * glm::quat(0, 0, 0, 1) * ...
says thew
component is first, and the last argument must bez
. \$\endgroup\$