 |
Box2D
2.4.1
A 2D physics engine for games
|
23 #ifndef B2_PRISMATIC_JOINT_H
24 #define B2_PRISMATIC_JOINT_H
39 type = e_prismaticJoint;
40 localAnchorA.SetZero();
41 localAnchorB.SetZero();
42 localAxisA.Set(1.0f, 0.0f);
43 referenceAngle = 0.0f;
45 lowerTranslation = 0.0f;
46 upperTranslation = 0.0f;
143 float GetMotorSpeed()
const;
147 float GetMaxMotorForce()
const {
return m_maxMotorForce; }
163 void InitVelocityConstraints(
const b2SolverData& data)
override;
164 void SolveVelocityConstraints(
const b2SolverData& data)
override;
165 bool SolvePositionConstraints(
const b2SolverData& data)
override;
171 float m_referenceAngle;
173 float m_motorImpulse;
174 float m_lowerImpulse;
175 float m_upperImpulse;
176 float m_lowerTranslation;
177 float m_upperTranslation;
178 float m_maxMotorForce;
A 2D column vector.
Definition: b2_math.h:42
bool enableLimit
Enable/disable the joint limit.
Definition: b2_prismatic_joint.h:69
A rigid body. These are created via b2World::CreateBody.
Definition: b2_body.h:129
void EnableMotor(bool flag)
Enable/disable the joint motor.
float GetReactionTorque(float inv_dt) const override
Get the reaction torque on bodyB in N*m.
void Draw(b2Draw *draw) const override
Debug draw this joint.
float referenceAngle
The constrained angle between the bodies: bodyB_angle - bodyA_angle.
Definition: b2_prismatic_joint.h:66
float GetMotorSpeed() const
Get the motor speed, usually in meters per second.
Definition: b2_prismatic_joint.h:200
bool enableMotor
Enable/disable the joint motor.
Definition: b2_prismatic_joint.h:78
void EnableLimit(bool flag)
Enable/disable the joint limit.
Joint definitions are used to construct joints.
Definition: b2_joint.h:73
bool IsLimitEnabled() const
Is the joint limit enabled?
Definition: b2_prismatic_joint.h:36
float GetLowerLimit() const
Get the lower joint limit, usually in meters.
b2Vec2 GetAnchorB() const override
Get the anchor point on bodyB in world coordinates.
Definition: b2_prismatic_joint.h:92
float GetJointSpeed() const
Get the current joint translation speed, usually in meters per second.
void SetLimits(float lower, float upper)
Set the joint limits, usually in meters.
float motorSpeed
The desired motor speed in radians per second.
Definition: b2_prismatic_joint.h:84
b2Vec2 localAxisA
The local translation unit axis in bodyA.
Definition: b2_prismatic_joint.h:63
b2Vec2 GetAnchorA() const override
Get the anchor point on bodyA in world coordinates.
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition: b2_prismatic_joint.h:60
void SetMaxMotorForce(float force)
Set the maximum motor force, usually in N.
float maxMotorForce
The maximum motor torque, usually in N-m.
Definition: b2_prismatic_joint.h:81
float GetUpperLimit() const
Get the upper joint limit, usually in meters.
const b2Vec2 & GetLocalAnchorA() const
The local anchor point relative to bodyA's origin.
Definition: b2_prismatic_joint.h:101
float lowerTranslation
The lower translation limit, usually in meters.
Definition: b2_prismatic_joint.h:72
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
Definition: b2_prismatic_joint.h:57
Definition: b2_gear_joint.h:62
A 2-by-2 matrix. Stored in column-major order.
Definition: b2_math.h:172
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchor, const b2Vec2 &axis)
void SetMotorSpeed(float speed)
Set the motor speed, usually in meters per second.
Solver Data.
Definition: b2_time_step.h:68
float GetMotorForce(float inv_dt) const
Get the current motor force given the inverse time step, usually in N.
b2Vec2 GetReactionForce(float inv_dt) const override
Get the reaction force on bodyB at the joint anchor in Newtons.
const b2Vec2 & GetLocalAnchorB() const
The local anchor point relative to bodyB's origin.
Definition: b2_prismatic_joint.h:104
void Dump() override
Dump to b2Log.
Definition: b2_joint.h:111
bool IsMotorEnabled() const
Is the joint motor enabled?
float upperTranslation
The upper translation limit, usually in meters.
Definition: b2_prismatic_joint.h:75
const b2Vec2 & GetLocalAxisA() const
The local joint axis relative to bodyA.
Definition: b2_prismatic_joint.h:107
float GetJointTranslation() const
Get the current joint translation, usually in meters.
float GetReferenceAngle() const
Get the reference angle.
Definition: b2_prismatic_joint.h:110