100 bool fixedRotation = (iA + iB == 0.0f);
193 bool fixedRotation = (iA + iB == 0.0f);
214 b2Vec3 Cdot(Cdot1.
x, Cdot1.
y, Cdot2);
225 if (newImpulse < 0.0
f)
229 impulse.
x = reduced.
x;
230 impulse.
y = reduced.
y;
244 if (newImpulse > 0.0
f)
248 impulse.
x = reduced.
x;
249 impulse.
y = reduced.
y;
298 b2Rot qA(aA), qB(aB);
316 angularError =
b2Abs(C);
338 aB += m_invIB * limitImpulse;
349 positionError = C.
Length();
355 K.
ex.
x = mA + mB + iA * rA.y * rA.y + iB * rB.
y * rB.
y;
356 K.
ex.
y = -iA * rA.x * rA.y - iB * rB.
x * rB.
y;
358 K.
ey.
y = mA + mB + iA * rA.x * rA.x + iB * rB.
x * rB.
x;
363 aA -= iA *
b2Cross(rA, impulse);
366 aB += iB *
b2Cross(rB, impulse);
488 b2Log(
" b2RevoluteJointDef jd;\n");
489 b2Log(
" jd.bodyA = bodies[%d];\n", indexA);
490 b2Log(
" jd.bodyB = bodies[%d];\n", indexB);
501 b2Log(
" joints[%d] = m_world->CreateJoint(&jd);\n",
m_index);
float32 upperAngle
The upper angle for the joint limit (radians).
b2Vec2 b2Mul(const b2Mat22 &A, const b2Vec2 &v)
b2Vec2 GetReactionForce(float32 inv_dt) const
void b2Log(const char *string,...)
Logging function.
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
bool IsMotorEnabled() const
Is the joint motor enabled?
void Dump()
Dump to b2Log.
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchor)
b2Vec2 GetAnchorA() const
Get the anchor point on bodyA in world coordinates.
void InitVelocityConstraints(const b2SolverData &data)
float32 GetJointAngle() const
Get the current joint angle in radians.
b2LimitState m_limitState
b2Vec2 GetAnchorB() const
Get the anchor point on bodyB in world coordinates.
void SolveVelocityConstraints(const b2SolverData &data)
#define b2_maxAngularCorrection
bool SolvePositionConstraints(const b2SolverData &data)
b2Vec2 GetWorldPoint(const b2Vec2 &localPoint) const
void SetMaxMotorTorque(float32 torque)
Set the maximum motor torque, usually in N-m.
float32 motorSpeed
The desired motor speed. Usually in radians per second.
b2Vec2 localCenter
local center of mass position
void SetLimits(float32 lower, float32 upper)
Set the joint limits in radians.
float32 b2Cross(const b2Vec2 &a, const b2Vec2 &b)
Perform the cross product on two vectors. In 2D this produces a scalar.
void EnableMotor(bool flag)
Enable/disable the joint motor.
A 2D column vector with 3 elements.
void SetZero()
Set this vector to all zeros.
A rigid body. These are created via b2World::CreateBody.
float32 GetLowerLimit() const
Get the lower joint limit in radians.
float32 referenceAngle
The bodyB angle minus bodyA angle in the reference state (radians).
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
bool enableMotor
A flag to enable the joint motor.
b2Vec2 Solve(const b2Vec2 &b) const
float32 GetJointSpeed() const
Get the current joint angle speed in radians per second.
b2RevoluteJoint(const b2RevoluteJointDef *def)
b2Vec2 GetLocalPoint(const b2Vec2 &worldPoint) const
b2Vec2 Solve22(const b2Vec2 &b) const
b2Vec3 Solve33(const b2Vec3 &b) const
bool IsLimitEnabled() const
Is the joint limit enabled?
void Set(float32 angle)
Set using an angle in radians.
T b2Clamp(T a, T low, T high)
void SetMotorSpeed(float32 speed)
Set the motor speed in radians per second.
float32 lowerAngle
The lower angle for the joint limit (radians).
A 2-by-2 matrix. Stored in column-major order.
bool enableLimit
A flag to enable joint limits.
float32 m_angularVelocity
void EnableLimit(bool flag)
Enable/disable the joint limit.
b2Body * bodyA
The first attached body.
float32 Length() const
Get the length of this vector (the norm).
float32 GetMotorTorque(float32 inv_dt) const
b2Body * bodyB
The second attached body.
float32 GetReactionTorque(float32 inv_dt) const
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble f
float32 GetUpperLimit() const
Get the upper joint limit in radians.