19 #ifndef B2_WHEEL_JOINT_H 20 #define B2_WHEEL_JOINT_H 22 #include <Box2D/Dynamics/Joints/b2Joint.h> 85 b2Vec2 GetReactionForce(float32 inv_dt)
const;
86 float32 GetReactionTorque(float32 inv_dt)
const;
98 float32 GetJointTranslation()
const;
101 float32 GetJointSpeed()
const;
104 bool IsMotorEnabled()
const;
107 void EnableMotor(
bool flag);
110 void SetMotorSpeed(float32 speed);
113 float32 GetMotorSpeed()
const;
116 void SetMaxMotorTorque(float32 torque);
117 float32 GetMaxMotorTorque()
const;
120 float32 GetMotorTorque(float32 inv_dt)
const;
123 void SetSpringFrequencyHz(float32 hz);
124 float32 GetSpringFrequencyHz()
const;
127 void SetSpringDampingRatio(float32 ratio);
128 float32 GetSpringDampingRatio()
const;
139 void SolveVelocityConstraints(
const b2SolverData& data);
140 bool SolvePositionConstraints(
const b2SolverData& data);
142 float32 m_frequencyHz;
143 float32 m_dampingRatio;
152 float32 m_motorImpulse;
153 float32 m_springImpulse;
155 float32 m_maxMotorTorque;
156 float32 m_motorSpeed;
170 float32 m_sAx, m_sBx;
171 float32 m_sAy, m_sBy;
175 float32 m_springMass;
186 inline float32 b2WheelJoint::GetMaxMotorTorque()
const 188 return m_maxMotorTorque;
196 inline float32 b2WheelJoint::GetSpringFrequencyHz()
const 198 return m_frequencyHz;
203 m_dampingRatio = ratio;
206 inline float32 b2WheelJoint::GetSpringDampingRatio()
const 208 return m_dampingRatio;
void SetSpringDampingRatio(float32 ratio)
Set/Get the spring damping ratio.
Definition: b2WheelJoint.h:201
Definition: b2WheelJoint.h:30
b2Body * bodyA
The first attached body.
Definition: b2Joint.h:92
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
Definition: b2WheelJoint.h:50
const b2Vec2 & GetLocalAxisA() const
The local joint axis relative to bodyA.
Definition: b2WheelJoint.h:95
b2Body * bodyB
The second attached body.
Definition: b2Joint.h:95
Definition: b2Joint.h:103
float32 frequencyHz
Suspension frequency, zero indicates no suspension.
Definition: b2WheelJoint.h:68
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
Definition: b2Math.h:65
void SetZero()
Set this vector to all zeros.
Definition: b2Math.h:62
const b2Vec2 & GetLocalAnchorA() const
The local anchor point relative to bodyA's origin.
Definition: b2WheelJoint.h:89
bool enableMotor
Enable/disable the joint motor.
Definition: b2WheelJoint.h:59
b2JointType type
The joint type is set automatically for concrete joint types.
Definition: b2Joint.h:86
Solver Data.
Definition: b2TimeStep.h:63
float32 maxMotorTorque
The maximum motor torque, usually in N-m.
Definition: b2WheelJoint.h:62
Joint definitions are used to construct joints.
Definition: b2Joint.h:74
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition: b2WheelJoint.h:53
A rigid body. These are created via b2World::CreateBody.
Definition: b2Body.h:126
float32 motorSpeed
The desired motor speed in radians per second.
Definition: b2WheelJoint.h:65
float32 GetMotorSpeed() const
Get the motor speed, usually in radians per second.
Definition: b2WheelJoint.h:181
A 2D column vector.
Definition: b2Math.h:53
const b2Vec2 & GetLocalAnchorB() const
The local anchor point relative to bodyB's origin.
Definition: b2WheelJoint.h:92
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchor, const b2Vec2 &axis)
Definition: b2WheelJoint.cpp:39
Definition: b2WheelJoint.h:79
float32 dampingRatio
Suspension damping ratio, one indicates critical damping.
Definition: b2WheelJoint.h:71
b2Vec2 localAxisA
The local translation axis in bodyA.
Definition: b2WheelJoint.h:56
void SetSpringFrequencyHz(float32 hz)
Set/Get the spring frequency in hertz. Setting the frequency to zero disables the spring...
Definition: b2WheelJoint.h:191