Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Halt criteria for b2GearJoint::SolvePositionConstraints #691

Closed
louis-langholtz opened this issue Jun 27, 2021 · 0 comments · Fixed by #709
Closed

Halt criteria for b2GearJoint::SolvePositionConstraints #691

louis-langholtz opened this issue Jun 27, 2021 · 0 comments · Fixed by #709

Comments

@louis-langholtz
Copy link

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?

  1. Set a linear error variable to the max magnitude of the linear position deltas (of m_mA * impulse * JvA, m_mB * impulse * JvBD, etc.).
  2. Set a angular error variable to the max angular position delta (of aA += m_iA * impulse * JwA, aB += m_iB * impulse * JwB, etc.).
  3. Return true if the linear error is less than b2_linearSlop and the angular error is less than b2_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.

erincatto added a commit that referenced this issue Dec 31, 2021
@erincatto erincatto mentioned this issue Dec 31, 2021
@erincatto erincatto linked a pull request Dec 31, 2021 that will close this issue
erincatto added a commit that referenced this issue Dec 31, 2021
Small fixes for: #681, #686, #689, #690, #691, #692, #694, #695, #696
Fix workflow for main
brianwinterpixel pushed a commit to winterpixelgames/box2d that referenced this issue Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant