|
Box2D
2.4.1
A 2D physics engine for games
|
23 #ifndef B2_WHEEL_JOINT_H
24 #define B2_WHEEL_JOINT_H
40 localAnchorA.SetZero();
41 localAnchorB.SetZero();
42 localAxisA.Set(1.0f, 0.0f);
44 lowerTranslation = 0.0f;
45 upperTranslation = 0.0f;
47 maxMotorTorque = 0.0f;
114 float GetJointTranslation()
const;
117 float GetJointLinearSpeed()
const;
120 float GetJointAngle()
const;
123 float GetJointAngularSpeed()
const;
126 bool IsLimitEnabled()
const;
129 void EnableLimit(
bool flag);
132 float GetLowerLimit()
const;
135 float GetUpperLimit()
const;
138 void SetLimits(
float lower,
float upper);
141 bool IsMotorEnabled()
const;
144 void EnableMotor(
bool flag);
147 void SetMotorSpeed(
float speed);
150 float GetMotorSpeed()
const;
153 void SetMaxMotorTorque(
float torque);
154 float GetMaxMotorTorque()
const;
157 float GetMotorTorque(
float inv_dt)
const;
160 void SetStiffness(
float stiffness);
161 float GetStiffness()
const;
164 void SetDamping(
float damping);
165 float GetDamping()
const;
168 void Dump()
override;
178 void InitVelocityConstraints(
const b2SolverData& data)
override;
179 void SolveVelocityConstraints(
const b2SolverData& data)
override;
180 bool SolvePositionConstraints(
const b2SolverData& data)
override;
188 float m_motorImpulse;
189 float m_springImpulse;
191 float m_lowerImpulse;
192 float m_upperImpulse;
194 float m_lowerTranslation;
195 float m_upperTranslation;
197 float m_maxMotorTorque;
235 inline float b2WheelJoint::GetMaxMotorTorque()
const
237 return m_maxMotorTorque;
A 2D column vector.
Definition: b2_math.h:41
A rigid body. These are created via b2World::CreateBody.
Definition: b2_body.h:128
virtual b2Vec2 GetReactionForce(float inv_dt) const =0
Get the reaction force on bodyB at the joint anchor in Newtons.
virtual b2Vec2 GetAnchorA() const =0
Get the anchor point on bodyA in world coordinates.
Joint definitions are used to construct joints.
Definition: b2_joint.h:72
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition: b2_wheel_joint.h:61
float upperTranslation
The upper translation limit, usually in meters.
Definition: b2_wheel_joint.h:73
Definition: b2_wheel_joint.h:95
virtual void Draw(b2Draw *draw) const
Debug draw this joint.
float stiffness
Suspension stiffness. Typically in units N/m.
Definition: b2_wheel_joint.h:85
bool enableMotor
Enable/disable the joint motor.
Definition: b2_wheel_joint.h:76
float GetMotorSpeed() const
Get the motor speed, usually in radians per second.
Definition: b2_wheel_joint.h:230
virtual void Dump()
Dump this joint to the log file.
Definition: b2_joint.h:151
const b2Vec2 & GetLocalAxisA() const
The local joint axis relative to bodyA.
Definition: b2_wheel_joint.h:111
b2Vec2 localAxisA
The local translation axis in bodyA.
Definition: b2_wheel_joint.h:64
float damping
Suspension damping. Typically in units of N*s/m.
Definition: b2_wheel_joint.h:88
const b2Vec2 & GetLocalAnchorA() const
The local anchor point relative to bodyA's origin.
Definition: b2_wheel_joint.h:105
Definition: b2_wheel_joint.h:35
Solver Data.
Definition: b2_time_step.h:67
float maxMotorTorque
The maximum motor torque, usually in N-m.
Definition: b2_wheel_joint.h:79
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
Definition: b2_wheel_joint.h:58
bool enableLimit
Enable/disable the joint limit.
Definition: b2_wheel_joint.h:67
virtual b2Vec2 GetAnchorB() const =0
Get the anchor point on bodyB in world coordinates.
float motorSpeed
The desired motor speed in radians per second.
Definition: b2_wheel_joint.h:82
Definition: b2_joint.h:110
virtual float GetReactionTorque(float inv_dt) const =0
Get the reaction torque on bodyB in N*m.
float lowerTranslation
The lower translation limit, usually in meters.
Definition: b2_wheel_joint.h:70
const b2Vec2 & GetLocalAnchorB() const
The local anchor point relative to bodyB's origin.
Definition: b2_wheel_joint.h:108