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