Class Joint

java.lang.Object
org.jbox2d.dynamics.joints.Joint
Direct Known Subclasses:
ConstantVolumeJoint, DistanceJoint, FrictionJoint, GearJoint, MotorJoint, MouseJoint, PrismaticJoint, PulleyJoint, RevoluteJoint, RopeJoint, WeldJoint, WheelJoint

public abstract class Joint extends Object
The base joint class. Joints are used to constrain two bodies together in various fashions. Some joints also feature limits and motors.

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 Details

    • prev

      public Joint prev
    • next

      public Joint next
    • edgeA

      public JointEdge edgeA
    • edgeB

      public JointEdge edgeB
    • bodyA

      protected Body bodyA
    • bodyB

      protected Body bodyB
    • islandFlag

      public boolean islandFlag
    • userData

      public Object userData
    • pool

      protected WorldPool pool
  • Constructor Details

  • Method Details

    • create

      public static Joint create(World world, JointDef def)
    • destroy

      public static void destroy(Joint joint)
    • getType

      public JointType getType()
      Get the type of the concrete joint.
    • getBodyA

      public final Body getBodyA()
      Get the first body attached to this joint.
    • getBodyB

      public final Body getBodyB()
      Get the second body attached to this joint.
    • getAnchorA

      public abstract void getAnchorA(Vec2 out)
      Get the anchor point on bodyA in world coordinates.
    • getAnchorB

      public abstract void getAnchorB(Vec2 out)
      Get the anchor point on bodyB in world coordinates.
    • getReactionForce

      public abstract void getReactionForce(float invDt, Vec2 out)
      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

      public Joint getNext()
      Get the next joint the world joint list.
    • getUserData

      public Object getUserData()
      Get the user data pointer.
    • setUserData

      public void setUserData(Object data)
      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

      public abstract void initVelocityConstraints(SolverData data)
      Internal
    • solveVelocityConstraints

      public abstract void solveVelocityConstraints(SolverData data)
      Internal
    • solvePositionConstraints

      public abstract boolean solvePositionConstraints(SolverData data)
      This returns true if the position errors are within tolerance. Internal.
    • destructor

      public void destructor()
      Override to handle destruction of joint