56 float32 coordinateA, coordinateB;
166 b2Rot qA(aA), qB(aB), qC(aC), qD(aD);
207 m_mass = m_mass > 0.0f ? 1.0f / m_mass : 0.0f;
282 b2Rot qA(aA), qB(aB), qC(aC), qD(aD);
286 float32 coordinateA, coordinateB;
348 cA +=
m_mA * impulse * JvAC;
349 aA +=
m_iA * impulse * JwA;
350 cB +=
m_mB * impulse * JvBD;
351 aB +=
m_iB * impulse * JwB;
352 cC -=
m_mC * impulse * JvAC;
353 aC -=
m_iC * impulse * JwC;
354 cD -=
m_mD * impulse * JvBD;
355 aD -=
m_iD * impulse * JwD;
411 b2Log(
" b2GearJointDef jd;\n");
412 b2Log(
" jd.bodyA = bodies[%d];\n", indexA);
413 b2Log(
" jd.bodyB = bodies[%d];\n", indexB);
415 b2Log(
" jd.joint1 = joints[%d];\n", index1);
416 b2Log(
" jd.joint2 = joints[%d];\n", index2);
418 b2Log(
" joints[%d] = m_world->CreateJoint(&jd);\n",
m_index);
float32 b2Dot(const b2Vec2 &a, const b2Vec2 &b)
Perform the dot product on two vectors.
float32 m_referenceAngleA
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
b2Joint * joint2
The second revolute/prismatic joint attached to the gear joint.
void b2Log(const char *string,...)
Logging function.
b2Body * GetBodyA()
Get the first body attached to this joint.
bool SolvePositionConstraints(const b2SolverData &data)
void SolveVelocityConstraints(const b2SolverData &data)
b2JointType GetType() const
Get the type of the concrete joint.
b2Vec2 GetWorldPoint(const b2Vec2 &localPoint) const
float32 GetReactionTorque(float32 inv_dt) const
Get the reaction torque on bodyB in N*m.
void SetZero()
Set this vector to all zeros.
b2Vec2 GetReactionForce(float32 inv_dt) const
Get the reaction force on bodyB at the joint anchor in Newtons.
b2GearJoint(const b2GearJointDef *data)
b2Body * GetBodyB()
Get the second body attached to this joint.
b2Vec2 localCenter
local center of mass position
float32 b2Cross(const b2Vec2 &a, const b2Vec2 &b)
Perform the cross product on two vectors. In 2D this produces a scalar.
bool b2IsValid(float32 x)
This function is used to ensure that a floating point number is not a NaN or infinity.
b2Joint * joint1
The first revolute/prismatic joint attached to the gear joint.
float32 m_referenceAngleB
b2Vec2 GetAnchorB() const
Get the anchor point on bodyB in world coordinates.
b2Vec2 b2MulT(const b2Mat22 &A, const b2Vec2 &v)
void SetRatio(float32 ratio)
Set/Get the gear ratio.
b2Vec2 GetAnchorA() const
Get the anchor point on bodyA in world coordinates.
void Dump()
Dump joint to dmLog.
void InitVelocityConstraints(const b2SolverData &data)