23 #ifndef B2_MOTOR_JOINT_H 24 #define B2_MOTOR_JOINT_H 35 linearOffset.SetZero();
39 correctionFactor = 0.3f;
74 void SetLinearOffset(
const b2Vec2& linearOffset);
75 const b2Vec2& GetLinearOffset()
const;
78 void SetAngularOffset(
float angularOffset);
79 float GetAngularOffset()
const;
82 void SetMaxForce(
float force);
85 float GetMaxForce()
const;
88 void SetMaxTorque(
float torque);
91 float GetMaxTorque()
const;
94 void SetCorrectionFactor(
float factor);
97 float GetCorrectionFactor()
const;
100 void Dump()
override;
108 void InitVelocityConstraints(
const b2SolverData& data)
override;
109 void SolveVelocityConstraints(
const b2SolverData& data)
override;
110 bool SolvePositionConstraints(
const b2SolverData& data)
override;
114 float m_angularOffset;
116 float m_angularImpulse;
119 float m_correctionFactor;
129 float m_angularError;
Definition: b2_motor_joint.h:64
float angularOffset
The bodyB angle minus bodyA angle in radians.
Definition: b2_motor_joint.h:49
float maxTorque
The maximum motor torque in N-m.
Definition: b2_motor_joint.h:55
Motor joint definition.
Definition: b2_motor_joint.h:30
Definition: b2_joint.h:110
virtual b2Vec2 GetAnchorA() const =0
Get the anchor point on bodyA in world coordinates.
virtual b2Vec2 GetAnchorB() const =0
Get the anchor point on bodyB in world coordinates.
virtual float GetReactionTorque(float inv_dt) const =0
Get the reaction torque on bodyB in N*m.
Solver Data.
Definition: b2_time_step.h:67
A 2-by-2 matrix. Stored in column-major order.
Definition: b2_math.h:171
Joint definitions are used to construct joints.
Definition: b2_joint.h:72
A rigid body. These are created via b2World::CreateBody.
Definition: b2_body.h:128
float correctionFactor
Position correction factor in the range [0,1].
Definition: b2_motor_joint.h:58
virtual void Dump()
Dump this joint to the log file.
Definition: b2_joint.h:151
virtual b2Vec2 GetReactionForce(float inv_dt) const =0
Get the reaction force on bodyB at the joint anchor in Newtons.
float maxForce
The maximum motor force in N.
Definition: b2_motor_joint.h:52
A 2D column vector.
Definition: b2_math.h:41
b2Vec2 linearOffset
Position of bodyB minus the position of bodyA, in bodyA's frame, in meters.
Definition: b2_motor_joint.h:46