 |
Box2D
2.4.1
A 2D physics engine for games
|
23 #ifndef B2_PULLEY_JOINT_H
24 #define B2_PULLEY_JOINT_H
29 const float b2_minPulleyLength = 2.0f;
38 groundAnchorA.Set(-1.0f, 1.0f);
39 groundAnchorB.Set(1.0f, 1.0f);
40 localAnchorA.Set(-1.0f, 0.0f);
41 localAnchorB.Set(1.0f, 0.0f);
45 collideConnected =
true;
50 const b2Vec2& groundAnchorA,
const b2Vec2& groundAnchorB,
125 void InitVelocityConstraints(
const b2SolverData& data)
override;
126 void SolveVelocityConstraints(
const b2SolverData& data)
override;
127 bool SolvePositionConstraints(
const b2SolverData& data)
override;
A 2D column vector.
Definition: b2_math.h:42
A rigid body. These are created via b2World::CreateBody.
Definition: b2_body.h:129
float GetCurrentLengthB() const
Get the current length of the segment attached to bodyB.
b2Vec2 GetAnchorA() const override
Get the anchor point on bodyA in world coordinates.
b2Vec2 groundAnchorB
The second ground anchor in world coordinates. This point never moves.
Definition: b2_pulley_joint.h:58
void ShiftOrigin(const b2Vec2 &newOrigin) override
Implement b2Joint::ShiftOrigin.
float lengthB
The a reference length for the segment attached to bodyB.
Definition: b2_pulley_joint.h:70
b2Vec2 GetReactionForce(float inv_dt) const override
Get the reaction force on bodyB at the joint anchor in Newtons.
float GetLengthA() const
Get the current length of the segment attached to bodyA.
Definition: b2_pulley_joint.h:34
Joint definitions are used to construct joints.
Definition: b2_joint.h:73
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition: b2_pulley_joint.h:64
void Dump() override
Dump joint to dmLog.
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &groundAnchorA, const b2Vec2 &groundAnchorB, const b2Vec2 &anchorA, const b2Vec2 &anchorB, float ratio)
Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
float GetRatio() const
Get the pulley ratio.
float ratio
The pulley ratio, used to simulate a block-and-tackle.
Definition: b2_pulley_joint.h:73
b2Vec2 GetGroundAnchorA() const
Get the first ground anchor.
b2Vec2 groundAnchorA
The first ground anchor in world coordinates. This point never moves.
Definition: b2_pulley_joint.h:55
b2Vec2 GetGroundAnchorB() const
Get the second ground anchor.
float GetReactionTorque(float inv_dt) const override
Get the reaction torque on bodyB in N*m.
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
Definition: b2_pulley_joint.h:61
Solver Data.
Definition: b2_time_step.h:68
float GetLengthB() const
Get the current length of the segment attached to bodyB.
Definition: b2_joint.h:111
float lengthA
The a reference length for the segment attached to bodyA.
Definition: b2_pulley_joint.h:67
float GetCurrentLengthA() const
Get the current length of the segment attached to bodyA.
b2Vec2 GetAnchorB() const override
Get the anchor point on bodyB in world coordinates.
Definition: b2_pulley_joint.h:85