Problem with hinge constraint

Post Reply
aclong
Posts: 3
Joined: Sat Jan 16, 2010 4:54 am

Problem with hinge constraint

Post by aclong »

Hi,

I posted a bug about this but then a colleague told me that it was preferred to post to the forum first, then file a bug. (The bug, BTW, is #377.)

Anyway, the issue I'm having is about angle comparisons for limits of hinge constraints (btHingeConstraint). The problem comes when the lower limit - hinge angle is less than pi. In this situation, btAdjustAngleToLimits returns the angle back, but it should return the angle + 2pi because in the angle is really closer to the upper limit than the lower.

There is a comment in two places in this function that says "this is positive", but that's not always true, and it's in those cases that the function returns the wrong answer. I've tried adding btFabs on those two lines to make sure they really are always positive, and it seems to resolve the problem.

Sorry for forum-posting & bug-filing in the wrong order.

- Chris
Post Reply