Halt criteria for b2GearJoint::SolvePositionConstraints
louis-langholtz opened this issue · comments
Louis Langholtz commented
I've noticed that the return value for b2GearJoint::SolvePositionConstraints
of return linearError < b2_linearSlop
is commented with TODO_ERIN not implemented
and that the linearError
variable is only initialized to 0.0f
making the function always return true.
Might something like the following be an algorithmic description of an implementation for this that would be reasonable/desirable/helpful?
- Set a linear error variable to the max magnitude of the linear position deltas (of
m_mA * impulse * JvA
,m_mB * impulse * JvBD
, etc.). - Set a angular error variable to the max angular position delta (of
aA += m_iA * impulse * JwA
,aB += m_iB * impulse * JwB
, etc.). - Return true if the linear error is less than
b2_linearSlop
and the angular error is less thanb2_angularSlop
, or return false otherwise.
With potentially an optimization like using the magnitude squared instead of the magnitude to avoid doing the square roots and compensating with using the squared value of b2_linearSlop
.