Class Joint
- Direct Known Subclasses:
ConstantVolumeJoint,DistanceJoint,FrictionJoint,GearJoint,MotorJoint,MouseJoint,PrismaticJoint,PulleyJoint,RevoluteJoint,RopeJoint,WeldJoint,WheelJoint
Joints are used to constrain bodies to the world or to each other. Typical examples in games include ragdolls, teeters, and pulleys. Joints can be combined in many different ways to create interesting motions.
Some joints provide limits so you can control the range of motion. Some joint provide motors which can be used to drive the joint at a prescribed speed until a prescribed force/torque is exceeded.
Joint motors can be used in many ways. You can use motors to control position by specifying a joint velocity that is proportional to the difference between the actual and desired position. You can also use motors to simulate joint friction: set the joint velocity to zero and provide a small, but significant maximum motor force/torque. Then the motor will attempt to keep the joint from moving until the load becomes too strong.
https://box2d.org/documentation/md__d_1__git_hub_box2d_docs_dynamics.html#autotoc_md81- Author:
- Daniel Murphy
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Jointstatic voidvoidOverride to handle destruction of jointabstract voidgetAnchorA(Vec2 out) Get the anchor point on bodyA in world coordinates.abstract voidgetAnchorB(Vec2 out) Get the anchor point on bodyB in world coordinates.final BodygetBodyA()Get the first body attached to this joint.final BodygetBodyB()Get the second body attached to this joint.final booleanGet collide connected.getNext()Get the next joint the world joint list.abstract voidgetReactionForce(float invDt, Vec2 out) Get the reaction force on body2 at the joint anchor in Newtons.abstract floatgetReactionTorque(float invDt) Get the reaction torque on body2 in N*m.getType()Get the type of the concrete joint.Get the user data pointer.abstract voidInternalbooleanisActive()Short-cut function to determine if either body is inactive.voidsetUserData(Object data) Set the user data pointer.abstract booleanThis returns true if the position errors are within tolerance.abstract voidInternal
-
Field Details
-
prev
-
next
-
edgeA
-
edgeB
-
bodyA
-
bodyB
-
islandFlag
public boolean islandFlag -
userData
-
pool
-
-
Constructor Details
-
Joint
-
-
Method Details
-
create
-
destroy
-
getType
Get the type of the concrete joint. -
getBodyA
Get the first body attached to this joint. -
getBodyB
Get the second body attached to this joint. -
getAnchorA
Get the anchor point on bodyA in world coordinates. -
getAnchorB
Get the anchor point on bodyB in world coordinates. -
getReactionForce
Get the reaction force on body2 at the joint anchor in Newtons. -
getReactionTorque
public abstract float getReactionTorque(float invDt) Get the reaction torque on body2 in N*m. -
getNext
Get the next joint the world joint list. -
getUserData
Get the user data pointer. -
setUserData
Set the user data pointer. -
getCollideConnected
public final boolean getCollideConnected()Get collide connected. Note: modifying the collide connect flag won't work correctly because the flag is only checked when fixture AABBs begin to overlap. -
isActive
public boolean isActive()Short-cut function to determine if either body is inactive. -
initVelocityConstraints
Internal -
solveVelocityConstraints
Internal -
solvePositionConstraints
This returns true if the position errors are within tolerance. Internal. -
destructor
public void destructor()Override to handle destruction of joint
-