
364 Chapter 14 Collision Resolution
real limit = angularLimitConstant *
relativeContactPosition.magnitude();
// Check that the angular move is within limits.
if (real_abs(angularMove) > limit)
{
real totalMove = linearMove + angularMove;
// Set the new angular move, with the same sign as before.
if (angularMove >= 0) {
angularMove = limit;
} else {
angularMove = -limit;
}
// Make the linear move take the extra slack.
linearMove = totalMove - angularMove;
}
The value fo r angularLimitConstantneeds to be determined by playing with your
particular simulation. I have found that values around 0.2 give good results, although
lower values are better when very boun