Permalink
Browse files

Fixed issue 242. Negative gear ratio instability.

git-svn-id: http://box2d.googlecode.com/svn/trunk@222 cafe418c-1137-0410-84cc-357ec87a5d9b
  • Loading branch information...
1 parent 670c915 commit 0dbc251a462510ce444cbfd726e05b9f8235375a erincatto@gmail.com committed Sep 8, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 Box2D/Box2D/Dynamics/Joints/b2GearJoint.cpp
@@ -55,6 +55,8 @@ b2GearJoint::b2GearJoint(const b2GearJointDef* def)
float32 coordinateA, coordinateB;
+ // TODO_ERIN there might be some problem with the joint edges in b2Joint.
+
m_bodyC = m_joint1->GetBodyA();
m_bodyA = m_joint1->GetBodyB();
@@ -318,9 +320,9 @@ bool b2GearJoint::SolvePositionConstraints(const b2SolverData& data)
if (m_typeB == e_revoluteJoint)
{
JvBD.SetZero();
- JwB = 1.0f;
- JwD = 1.0f;
- mass += m_iB + m_iD;
+ JwB = m_ratio;
+ JwD = m_ratio;
+ mass += m_ratio * m_ratio * (m_iB + m_iD);
coordinateB = aB - aD - m_referenceAngleB;
}

0 comments on commit 0dbc251

Please sign in to comment.