23#ifndef B2_MOTOR_JOINT_H 
   24#define B2_MOTOR_JOINT_H 
   35        linearOffset.SetZero();
 
   39        correctionFactor = 0.3f;
 
 
   75    const b2Vec2& GetLinearOffset() 
const;
 
   79    float GetAngularOffset() 
const;
 
  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;
 
 
A rigid body. These are created via b2World::CreateBody.
Definition b2_body.h:129
Definition b2_joint.h:111
Definition b2_motor_joint.h:65
float GetMaxForce() const
Get the maximum friction force in N.
void SetCorrectionFactor(float factor)
Set the position correction factor in the range [0,1].
float GetReactionTorque(float inv_dt) const override
Get the reaction torque on bodyB in N*m.
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.
b2Vec2 GetReactionForce(float inv_dt) const override
Get the reaction force on bodyB at the joint anchor in Newtons.
void SetMaxTorque(float torque)
Set the maximum friction torque in N*m.
float GetCorrectionFactor() const
Get the position correction factor in the range [0,1].
void SetLinearOffset(const b2Vec2 &linearOffset)
Set/get the target linear offset, in frame A, in meters.
void SetMaxForce(float force)
Set the maximum friction force in N.
float GetMaxTorque() const
Get the maximum friction torque in N*m.
void SetAngularOffset(float angularOffset)
Set/get the target angular offset, in radians.
void Dump() override
Dump to b2Log.
Joint definitions are used to construct joints.
Definition b2_joint.h:73
A 2-by-2 matrix. Stored in column-major order.
Definition b2_math.h:172
Motor joint definition.
Definition b2_motor_joint.h:31
float maxForce
The maximum motor force in N.
Definition b2_motor_joint.h:52
float correctionFactor
Position correction factor in the range [0,1].
Definition b2_motor_joint.h:58
b2Vec2 linearOffset
Position of bodyB minus the position of bodyA, in bodyA's frame, in meters.
Definition b2_motor_joint.h:46
float angularOffset
The bodyB angle minus bodyA angle in radians.
Definition b2_motor_joint.h:49
void Initialize(b2Body *bodyA, b2Body *bodyB)
Initialize the bodies and offsets using the current transforms.
float maxTorque
The maximum motor torque in N-m.
Definition b2_motor_joint.h:55
Solver Data.
Definition b2_time_step.h:68
A 2D column vector.
Definition b2_math.h:42