 |
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;
140 float GetMotorSpeed()
const;
144 float GetMaxMotorTorque()
const {
return m_maxMotorTorque; }
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:42
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:129
float upperAngle
The upper angle for the joint limit (radians).
Definition: b2_revolute_joint.h:75
b2Vec2 GetAnchorB() const override
Get the anchor point on bodyB in world coordinates.
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition: b2_revolute_joint.h:63
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
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchor)
void EnableMotor(bool flag)
Enable/disable the joint motor.
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:73
void Dump() override
Dump to b2Log.
void SetMaxMotorTorque(float torque)
Set the maximum motor torque, usually in N-m.
bool IsLimitEnabled() const
Is the joint limit enabled?
float GetReactionTorque(float inv_dt) const override
bool enableLimit
A flag to enable joint limits.
Definition: b2_revolute_joint.h:69
float GetLowerLimit() const
Get the lower joint limit in radians.
bool IsMotorEnabled() const
Is the joint motor enabled?
Definition: b2_revolute_joint.h:40
Definition: b2_revolute_joint.h:95
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
void SetLimits(float lower, float upper)
Set the joint limits in radians.
void Draw(b2Draw *draw) const override
Debug draw this joint.
float GetMotorTorque(float inv_dt) const
float GetJointSpeed() const
Get the current joint angle speed in radians per second.
Definition: b2_gear_joint.h:62
float GetUpperLimit() const
Get the upper joint limit in radians.
A 2-by-2 matrix. Stored in column-major order.
Definition: b2_math.h:172
Solver Data.
Definition: b2_time_step.h:68
void EnableLimit(bool flag)
Enable/disable the joint limit.
void SetMotorSpeed(float speed)
Set the motor speed in radians per second.
Definition: b2_joint.h:111
float GetJointAngle() const
Get the current joint angle in radians.
b2Vec2 GetAnchorA() const override
Get the anchor point on bodyA in world coordinates.
float lowerAngle
The lower angle for the joint limit (radians).
Definition: b2_revolute_joint.h:72
b2Vec2 GetReactionForce(float inv_dt) const override
const b2Vec2 & GetLocalAnchorB() const
The local anchor point relative to bodyB's origin.
Definition: b2_revolute_joint.h:104