#include <b2_revolute_joint.h>
Public Member Functions | |
void | Draw (b2Draw *draw) const override |
Debug draw this joint. More... | |
void | Dump () override |
Dump to b2Log. More... | |
void | EnableLimit (bool flag) |
Enable/disable the joint limit. More... | |
void | EnableMotor (bool flag) |
Enable/disable the joint motor. More... | |
b2Vec2 | GetAnchorA () const override |
Get the anchor point on bodyA in world coordinates. More... | |
b2Vec2 | GetAnchorB () const override |
Get the anchor point on bodyB in world coordinates. More... | |
float | GetJointAngle () const |
Get the current joint angle in radians. More... | |
float | GetJointSpeed () const |
Get the current joint angle speed in radians per second. More... | |
const b2Vec2 & | GetLocalAnchorA () const |
The local anchor point relative to bodyA's origin. More... | |
const b2Vec2 & | GetLocalAnchorB () const |
The local anchor point relative to bodyB's origin. More... | |
float | GetLowerLimit () const |
Get the lower joint limit in radians. More... | |
float | GetMaxMotorTorque () const |
float | GetMotorSpeed () const |
Get the motor speed in radians per second. More... | |
float | GetMotorTorque (float inv_dt) const |
b2Vec2 | GetReactionForce (float inv_dt) const override |
float | GetReactionTorque (float inv_dt) const override |
float | GetReferenceAngle () const |
Get the reference angle. More... | |
float | GetUpperLimit () const |
Get the upper joint limit in radians. More... | |
bool | IsLimitEnabled () const |
Is the joint limit enabled? More... | |
bool | IsMotorEnabled () const |
Is the joint motor enabled? More... | |
void | SetLimits (float lower, float upper) |
Set the joint limits in radians. More... | |
void | SetMaxMotorTorque (float torque) |
Set the maximum motor torque, usually in N-m. More... | |
void | SetMotorSpeed (float speed) |
Set the motor speed in radians per second. More... | |
![]() | |
b2Body * | GetBodyA () |
Get the first body attached to this joint. More... | |
b2Body * | GetBodyB () |
Get the second body attached to this joint. More... | |
bool | GetCollideConnected () const |
b2Joint * | GetNext () |
Get the next joint the world joint list. More... | |
const b2Joint * | GetNext () const |
b2JointType | GetType () const |
Get the type of the concrete joint. More... | |
b2JointUserData & | GetUserData () |
Get the user data pointer. More... | |
bool | IsEnabled () const |
Short-cut function to determine if either body is enabled. More... | |
virtual void | ShiftOrigin (const b2Vec2 &newOrigin) |
Shift the origin for any points stored in world coordinates. More... | |
Protected Member Functions | |
b2RevoluteJoint (const b2RevoluteJointDef *def) | |
void | InitVelocityConstraints (const b2SolverData &data) override |
bool | SolvePositionConstraints (const b2SolverData &data) override |
void | SolveVelocityConstraints (const b2SolverData &data) override |
![]() | |
b2Joint (const b2JointDef *def) | |
virtual | ~b2Joint () |
Protected Attributes | |
float | m_angle |
float | m_axialMass |
bool | m_enableLimit |
bool | m_enableMotor |
b2Vec2 | m_impulse |
int32 | m_indexA |
int32 | m_indexB |
float | m_invIA |
float | m_invIB |
float | m_invMassA |
float | m_invMassB |
b2Mat22 | m_K |
b2Vec2 | m_localAnchorA |
b2Vec2 | m_localAnchorB |
b2Vec2 | m_localCenterA |
b2Vec2 | m_localCenterB |
float | m_lowerAngle |
float | m_lowerImpulse |
float | m_maxMotorTorque |
float | m_motorImpulse |
float | m_motorSpeed |
b2Vec2 | m_rA |
b2Vec2 | m_rB |
float | m_referenceAngle |
float | m_upperAngle |
float | m_upperImpulse |
![]() | |
b2Body * | m_bodyA |
b2Body * | m_bodyB |
bool | m_collideConnected |
b2JointEdge | m_edgeA |
b2JointEdge | m_edgeB |
int32 | m_index |
bool | m_islandFlag |
b2Joint * | m_next |
b2Joint * | m_prev |
b2JointType | m_type |
b2JointUserData | m_userData |
Friends | |
class | b2GearJoint |
class | b2Joint |
Additional Inherited Members | |
![]() | |
static b2Joint * | Create (const b2JointDef *def, b2BlockAllocator *allocator) |
static void | Destroy (b2Joint *joint, b2BlockAllocator *allocator) |
A revolute joint constrains two bodies to share a common point while they are free to rotate about the point. The relative rotation about the shared point is the joint angle. You can limit the relative rotation with a joint limit that specifies a lower and upper angle. You can use a motor to drive the relative rotation about the shared point. A maximum motor torque is provided so that infinite forces are not generated.
Definition at line 94 of file b2_revolute_joint.h.
|
protected |
Definition at line 50 of file b2_revolute_joint.cpp.
Debug draw this joint.
Reimplemented from b2Joint.
Definition at line 462 of file b2_revolute_joint.cpp.
|
overridevirtual |
void b2RevoluteJoint::EnableLimit | ( | bool | flag | ) |
Enable/disable the joint limit.
Definition at line 403 of file b2_revolute_joint.cpp.
void b2RevoluteJoint::EnableMotor | ( | bool | flag | ) |
Enable/disable the joint motor.
Definition at line 363 of file b2_revolute_joint.cpp.
|
overridevirtual |
Get the anchor point on bodyA in world coordinates.
Implements b2Joint.
Definition at line 323 of file b2_revolute_joint.cpp.
|
overridevirtual |
Get the anchor point on bodyB in world coordinates.
Implements b2Joint.
Definition at line 328 of file b2_revolute_joint.cpp.
float b2RevoluteJoint::GetJointAngle | ( | ) | const |
Get the current joint angle in radians.
Definition at line 344 of file b2_revolute_joint.cpp.
float b2RevoluteJoint::GetJointSpeed | ( | ) | const |
Get the current joint angle speed in radians per second.
Definition at line 351 of file b2_revolute_joint.cpp.
|
inline |
The local anchor point relative to bodyA's origin.
Definition at line 101 of file b2_revolute_joint.h.
|
inline |
The local anchor point relative to bodyB's origin.
Definition at line 104 of file b2_revolute_joint.h.
float b2RevoluteJoint::GetLowerLimit | ( | ) | const |
Get the lower joint limit in radians.
Definition at line 415 of file b2_revolute_joint.cpp.
|
inline |
Definition at line 144 of file b2_revolute_joint.h.
|
inline |
Get the motor speed in radians per second.
Definition at line 206 of file b2_revolute_joint.h.
float b2RevoluteJoint::GetMotorTorque | ( | float | inv_dt | ) | const |
Get the current motor torque given the inverse time step. Unit is N*m.
Definition at line 373 of file b2_revolute_joint.cpp.
|
overridevirtual |
Get the reaction force given the inverse time step. Unit is N.
Implements b2Joint.
Definition at line 333 of file b2_revolute_joint.cpp.
|
overridevirtual |
Get the reaction torque due to the joint limit given the inverse time step. Unit is N*m.
Implements b2Joint.
Definition at line 339 of file b2_revolute_joint.cpp.
|
inline |
Get the reference angle.
Definition at line 107 of file b2_revolute_joint.h.
float b2RevoluteJoint::GetUpperLimit | ( | ) | const |
Get the upper joint limit in radians.
Definition at line 420 of file b2_revolute_joint.cpp.
|
overrideprotectedvirtual |
Implements b2Joint.
Definition at line 73 of file b2_revolute_joint.cpp.
bool b2RevoluteJoint::IsLimitEnabled | ( | ) | const |
Is the joint limit enabled?
Definition at line 398 of file b2_revolute_joint.cpp.
bool b2RevoluteJoint::IsMotorEnabled | ( | ) | const |
Is the joint motor enabled?
Definition at line 358 of file b2_revolute_joint.cpp.
void b2RevoluteJoint::SetLimits | ( | float | lower, |
float | upper | ||
) |
Set the joint limits in radians.
Definition at line 425 of file b2_revolute_joint.cpp.
void b2RevoluteJoint::SetMaxMotorTorque | ( | float | torque | ) |
Set the maximum motor torque, usually in N-m.
Definition at line 388 of file b2_revolute_joint.cpp.
void b2RevoluteJoint::SetMotorSpeed | ( | float | speed | ) |
Set the motor speed in radians per second.
Definition at line 378 of file b2_revolute_joint.cpp.
|
overrideprotectedvirtual |
Implements b2Joint.
Definition at line 245 of file b2_revolute_joint.cpp.
|
overrideprotectedvirtual |
Implements b2Joint.
Definition at line 167 of file b2_revolute_joint.cpp.
|
friend |
Definition at line 167 of file b2_revolute_joint.h.
|
friend |
Definition at line 166 of file b2_revolute_joint.h.
|
protected |
Definition at line 202 of file b2_revolute_joint.h.
|
protected |
Definition at line 203 of file b2_revolute_joint.h.
|
protected |
Definition at line 185 of file b2_revolute_joint.h.
|
protected |
Definition at line 182 of file b2_revolute_joint.h.
|
protected |
Definition at line 178 of file b2_revolute_joint.h.
|
protected |
Definition at line 191 of file b2_revolute_joint.h.
|
protected |
Definition at line 192 of file b2_revolute_joint.h.
|
protected |
Definition at line 199 of file b2_revolute_joint.h.
|
protected |
Definition at line 200 of file b2_revolute_joint.h.
|
protected |
Definition at line 197 of file b2_revolute_joint.h.
|
protected |
Definition at line 198 of file b2_revolute_joint.h.
|
protected |
Definition at line 201 of file b2_revolute_joint.h.
|
protected |
Definition at line 176 of file b2_revolute_joint.h.
|
protected |
Definition at line 177 of file b2_revolute_joint.h.
|
protected |
Definition at line 195 of file b2_revolute_joint.h.
|
protected |
Definition at line 196 of file b2_revolute_joint.h.
|
protected |
Definition at line 187 of file b2_revolute_joint.h.
|
protected |
Definition at line 180 of file b2_revolute_joint.h.
|
protected |
Definition at line 183 of file b2_revolute_joint.h.
|
protected |
Definition at line 179 of file b2_revolute_joint.h.
|
protected |
Definition at line 184 of file b2_revolute_joint.h.
|
protected |
Definition at line 193 of file b2_revolute_joint.h.
|
protected |
Definition at line 194 of file b2_revolute_joint.h.
|
protected |
Definition at line 186 of file b2_revolute_joint.h.
|
protected |
Definition at line 188 of file b2_revolute_joint.h.
|
protected |
Definition at line 181 of file b2_revolute_joint.h.