Bug in PxQuat::toRadiansAndUnitAxis ?

I am running into some puzzling behavior, where a slowly spinning box appears to pause after completing a full rotation. It seems the rotation is still simulated correctly, resulting in a constantly varying global pose PxTransform obtained for the shape. However, the angle of rotation obtained from the q member of this transform, remains at a constant value of 3.14… when the box is on its second rotation. To reproduce:

aBoxActor.setAngularVelocity(PxVec3(0,0,1)); // assume aBoxActor previously created with a single box shape
PxTransform pose = aBoxActor.getGlobalPose();
PxQuat Q=pose.q;
PxReal angle;
PxVec3 axis;

Set a breakpoint after the last line. The angle variable will correctly change at about one radian-per-second, for a while, then remain fixed for a same amount of time, then repeat this behavior periodically.

Am I using this feature incorrectly or is this a bug? The reason I need the angle/axis representation is that this is the most convenient way to transform the Modelview matrix in OpenGL.


That is troubling, I’ll try to reproduce it and get back to you ASAP.

Got it. It was indeed a bug, fixed in version 3.2.2. I can’t get 3.2.2 to play nice with the Windows runtime dll (I’ll start a new thread about this if I can’t figure it out), but I can keep using 3.2.0 and modify PxQuat.h as follows:

//angle = w<quatEpsilon ? PxPi : PxAtan2(s2*s, w) * 2;
  angle = PxAbs(w)<quatEpsilon ? PxPi : PxAtan2(s2*s, w) * 2;