|
Box2D
2.4.1
A 2D physics engine for games
|
23 #ifndef B2_REVOLUTE_JOINT_H
24 #define B2_REVOLUTE_JOINT_H
43 type = e_revoluteJoint;
44 localAnchorA.Set(0.0f, 0.0f);
45 localAnchorB.Set(0.0f, 0.0f);
46 referenceAngle = 0.0f;
49 maxMotorTorque = 0.0f;
110 float GetJointAngle()
const;
113 float GetJointSpeed()
const;
116 bool IsLimitEnabled()
const;
119 void EnableLimit(
bool flag);
122 float GetLowerLimit()
const;
125 float GetUpperLimit()
const;
128 void SetLimits(
float lower,
float upper);
131 bool IsMotorEnabled()
const;
134 void EnableMotor(
bool flag);
137 void SetMotorSpeed(
float speed);
140 float GetMotorSpeed()
const;
143 void SetMaxMotorTorque(
float torque);
144 float GetMaxMotorTorque()
const {
return m_maxMotorTorque; }
156 float GetMotorTorque(
float inv_dt)
const;
159 void Dump()
override;
171 void InitVelocityConstraints(
const b2SolverData& data)
override;
172 void SolveVelocityConstraints(
const b2SolverData& data)
override;
173 bool SolvePositionConstraints(
const b2SolverData& data)
override;
179 float m_motorImpulse;
180 float m_lowerImpulse;
181 float m_upperImpulse;
183 float m_maxMotorTorque;
186 float m_referenceAngle;
A 2D column vector.
Definition: b2_math.h:41
float GetReferenceAngle() const
Get the reference angle.
Definition: b2_revolute_joint.h:107
A rigid body. These are created via b2World::CreateBody.
Definition: b2_body.h:128
float upperAngle
The upper angle for the joint limit (radians).
Definition: b2_revolute_joint.h:75
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition: b2_revolute_joint.h:63
virtual b2Vec2 GetReactionForce(float inv_dt) const =0
Get the reaction force on bodyB at the joint anchor in Newtons.
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
Definition: b2_revolute_joint.h:60
bool enableMotor
A flag to enable the joint motor.
Definition: b2_revolute_joint.h:78
virtual b2Vec2 GetAnchorA() const =0
Get the anchor point on bodyA in world coordinates.
float GetMotorSpeed() const
Get the motor speed in radians per second.
Definition: b2_revolute_joint.h:206
float maxMotorTorque
Definition: b2_revolute_joint.h:85
Joint definitions are used to construct joints.
Definition: b2_joint.h:72
bool enableLimit
A flag to enable joint limits.
Definition: b2_revolute_joint.h:69
virtual void Draw(b2Draw *draw) const
Debug draw this joint.
Definition: b2_revolute_joint.h:39
virtual void Dump()
Dump this joint to the log file.
Definition: b2_joint.h:151
Definition: b2_revolute_joint.h:94
float motorSpeed
The desired motor speed. Usually in radians per second.
Definition: b2_revolute_joint.h:81
const b2Vec2 & GetLocalAnchorA() const
The local anchor point relative to bodyA's origin.
Definition: b2_revolute_joint.h:101
float referenceAngle
The bodyB angle minus bodyA angle in the reference state (radians).
Definition: b2_revolute_joint.h:66
Definition: b2_gear_joint.h:61
A 2-by-2 matrix. Stored in column-major order.
Definition: b2_math.h:171
Solver Data.
Definition: b2_time_step.h:67
virtual b2Vec2 GetAnchorB() const =0
Get the anchor point on bodyB in world coordinates.
Definition: b2_joint.h:110
virtual float GetReactionTorque(float inv_dt) const =0
Get the reaction torque on bodyB in N*m.
float lowerAngle
The lower angle for the joint limit (radians).
Definition: b2_revolute_joint.h:72
const b2Vec2 & GetLocalAnchorB() const
The local anchor point relative to bodyB's origin.
Definition: b2_revolute_joint.h:104