 |
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;
150 float GetMotorSpeed()
const;
154 float GetMaxMotorTorque()
const;
161 float GetStiffness()
const;
165 float GetDamping()
const;
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:42
A rigid body. These are created via b2World::CreateBody.
Definition: b2_body.h:129
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchor, const b2Vec2 &axis)
void EnableMotor(bool flag)
Enable/disable the joint motor.
void SetDamping(float damping)
Access damping.
float GetMotorTorque(float inv_dt) const
Get the current motor torque given the inverse time step, usually in N-m.
Joint definitions are used to construct joints.
Definition: b2_joint.h:73
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition: b2_wheel_joint.h:61
float GetJointTranslation() const
Get the current joint translation, usually in meters.
float GetLowerLimit() const
Get the lower joint translation limit, usually in meters.
float upperTranslation
The upper translation limit, usually in meters.
Definition: b2_wheel_joint.h:73
Definition: b2_wheel_joint.h:96
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 GetJointAngularSpeed() const
Get the current joint angular speed in radians per second.
void Dump() override
Dump to b2Log.
float GetJointLinearSpeed() const
Get the current joint linear speed, usually in meters per second.
float GetMotorSpeed() const
Get the motor speed, usually in radians per second.
Definition: b2_wheel_joint.h:230
const b2Vec2 & GetLocalAxisA() const
The local joint axis relative to bodyA.
Definition: b2_wheel_joint.h:111
bool IsLimitEnabled() const
Is the joint limit enabled?
bool IsMotorEnabled() const
Is the joint motor enabled?
void SetLimits(float lower, float upper)
Set the joint translation limits, usually in meters.
void Draw(b2Draw *draw) const override
Debug draw this joint.
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
void EnableLimit(bool flag)
Enable/disable the joint translation limit.
b2Vec2 GetAnchorB() const override
Get the anchor point on bodyB in world coordinates.
const b2Vec2 & GetLocalAnchorA() const
The local anchor point relative to bodyA's origin.
Definition: b2_wheel_joint.h:105
Definition: b2_wheel_joint.h:36
void SetStiffness(float stiffness)
Access spring stiffness.
Solver Data.
Definition: b2_time_step.h:68
float GetUpperLimit() const
Get the upper joint translation limit, usually in meters.
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
float motorSpeed
The desired motor speed in radians per second.
Definition: b2_wheel_joint.h:82
void SetMotorSpeed(float speed)
Set the motor speed, usually in radians per second.
Definition: b2_joint.h:111
float GetReactionTorque(float inv_dt) const override
Get the reaction torque on bodyB in N*m.
float lowerTranslation
The lower translation limit, usually in meters.
Definition: b2_wheel_joint.h:70
b2Vec2 GetAnchorA() const override
Get the anchor point on bodyA in world coordinates.
b2Vec2 GetReactionForce(float inv_dt) const override
Get the reaction force on bodyB at the joint anchor in Newtons.
void SetMaxMotorTorque(float torque)
Set/Get the maximum motor force, usually in N-m.
const b2Vec2 & GetLocalAnchorB() const
The local anchor point relative to bodyB's origin.
Definition: b2_wheel_joint.h:108
float GetJointAngle() const
Get the current joint angle in radians.