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 rigid body. These are created via b2World::CreateBody.
Definition b2_body.h:129
Definition b2_gear_joint.h:62
Definition b2_joint.h:110
Definition b2_revolute_joint.h:95
float GetJointAngle() const
Get the current joint angle in radians.
const b2Vec2 & GetLocalAnchorB() const
The local anchor point relative to bodyB's origin.
Definition b2_revolute_joint.h:104
bool IsMotorEnabled() const
Is the joint motor enabled?
void Dump() override
Dump to b2Log.
float GetUpperLimit() const
Get the upper joint limit in radians.
void EnableLimit(bool flag)
Enable/disable the joint limit.
float GetMotorTorque(float inv_dt) const
const b2Vec2 & GetLocalAnchorA() const
The local anchor point relative to bodyA's origin.
Definition b2_revolute_joint.h:101
void SetMotorSpeed(float speed)
Set the motor speed in radians per second.
float GetMotorSpeed() const
Get the motor speed in radians per second.
Definition b2_revolute_joint.h:206
b2Vec2 GetReactionForce(float inv_dt) const override
void SetMaxMotorTorque(float torque)
Set the maximum motor torque, usually in N-m.
float GetJointSpeed() const
Get the current joint angle speed in radians per second.
void EnableMotor(bool flag)
Enable/disable the joint motor.
float GetReferenceAngle() const
Get the reference angle.
Definition b2_revolute_joint.h:107
bool IsLimitEnabled() const
Is the joint limit enabled?
b2Vec2 GetAnchorA() const override
Get the anchor point on bodyA in world coordinates.
b2Vec2 GetAnchorB() const override
Get the anchor point on bodyB in world coordinates.
float GetReactionTorque(float inv_dt) const override
void Draw(b2Draw *draw) const override
Debug draw this joint.
void SetLimits(float lower, float upper)
Set the joint limits in radians.
float GetLowerLimit() const
Get the lower joint limit in radians.
Joint definitions are used to construct joints.
Definition b2_joint.h:72
A 2-by-2 matrix. Stored in column-major order.
Definition b2_math.h:172
Definition b2_revolute_joint.h:40
float lowerAngle
The lower angle for the joint limit (radians).
Definition b2_revolute_joint.h:72
bool enableLimit
A flag to enable joint limits.
Definition b2_revolute_joint.h:69
float motorSpeed
The desired motor speed. Usually in radians per second.
Definition b2_revolute_joint.h:81
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition b2_revolute_joint.h:63
float upperAngle
The upper angle for the joint limit (radians).
Definition b2_revolute_joint.h:75
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchor)
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
Definition b2_revolute_joint.h:60
float referenceAngle
The bodyB angle minus bodyA angle in the reference state (radians).
Definition b2_revolute_joint.h:66
bool enableMotor
A flag to enable the joint motor.
Definition b2_revolute_joint.h:78
float maxMotorTorque
Definition b2_revolute_joint.h:85
Solver Data.
Definition b2_time_step.h:68
A 2D column vector.
Definition b2_math.h:42