105 m_mass = invMass != 0.0f ? 1.0f / invMass : 0.0f;
123 m_gamma = m_gamma != 0.0f ? 1.0f / m_gamma : 0.0f;
127 m_mass = invMass != 0.0f ? 1.0f / invMass : 0.0f;
197 b2Rot qA(aA), qB(aB);
201 b2Vec2 u = cB + rB - cA - rA;
250 b2Log(
" b2DistanceJointDef jd;\n");
251 b2Log(
" jd.bodyA = bodies[%d];\n", indexA);
252 b2Log(
" jd.bodyB = bodies[%d];\n", indexB);
259 b2Log(
" joints[%d] = m_world->CreateJoint(&jd);\n",
m_index);
GLuint GLsizei GLsizei * length
float32 b2Dot(const b2Vec2 &a, const b2Vec2 &b)
Perform the dot product on two vectors.
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
void b2Log(const char *string,...)
Logging function.
void Dump()
Dump joint to dmLog.
void SolveVelocityConstraints(const b2SolverData &data)
b2Vec2 GetWorldPoint(const b2Vec2 &localPoint) const
#define b2_maxLinearCorrection
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.
A rigid body. These are created via b2World::CreateBody.
float32 dampingRatio
The damping ratio. 0 = no damping, 1 = critical damping.
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchorA, const b2Vec2 &anchorB)
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
float32 GetReactionTorque(float32 inv_dt) const
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
b2Vec2 GetAnchorA() const
Get the anchor point on bodyA in world coordinates.
b2Vec2 GetLocalPoint(const b2Vec2 &worldPoint) const
T b2Clamp(T a, T low, T high)
bool SolvePositionConstraints(const b2SolverData &data)
b2Vec2 GetReactionForce(float32 inv_dt) const
b2Body * bodyA
The first attached body.
float32 Normalize()
Convert this vector into a unit vector. Returns the length.
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
float32 Length() const
Get the length of this vector (the norm).
float32 length
The natural length between the anchor points.
b2Body * bodyB
The second attached body.
b2DistanceJoint(const b2DistanceJointDef *data)
void InitVelocityConstraints(const b2SolverData &data)
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble f
b2Vec2 GetAnchorB() const
Get the anchor point on bodyB in world coordinates.