Class JointDef
- Direct Known Subclasses:
ConstantVolumeJointDef,DistanceJointDef,FrictionJointDef,GearJointDef,MotorJointDef,MouseJointDef,PrismaticJointDef,PulleyJointDef,RevoluteJointDef,RopeJointDef,WeldJointDef,WheelJointDef
Each joint type has a definition that derives from JointDef. All
joints are connected between two different bodies. One body may static.
Joints between static and/or kinematic bodies are allowed, but have no effect
and use some processing time.
You can specify user data for any joint type and you can provide a flag to
prevent the attached bodies from colliding with each other. This is actually
the default behavior and you must set the collideConnected
Boolean to allow collision between to connected bodies.
Many joint definitions require that you provide some geometric data. Often a joint will be defined by anchor points. These are points fixed in the attached bodies. jbox2d requires these points to be specified in local coordinates. This way the joint can be specified even when the current body transforms violate the joint constraint - a common occurrence when a game is saved and reloaded. Additionally, some joint definitions need to know the default relative angle between the bodies. This is necessary to constrain rotation correctly.
Initializing the geometric data can be tedious, so many joints have initialization functions that use the current body transforms to remove much of the work. However, these initialization functions should usually only be used for prototyping. Production code should define the geometry directly. This will make joint behavior more robust.
The rest of the joint definition data depends on the joint type.
https://box2d.org/documentation/md__d_1__git_hub_box2d_docs_dynamics.html#autotoc_md82- Author:
- Daniel Murphy
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe first attached body.The second attached body.booleanSet this flag to true if the attached bodies should collide.The joint type is set automatically for concrete joint types.Use this to attach application specific data to your joints. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
type
The joint type is set automatically for concrete joint types. -
userData
Use this to attach application specific data to your joints. -
bodyA
The first attached body. -
bodyB
The second attached body. -
collideConnected
public boolean collideConnectedSet this flag to true if the attached bodies should collide.
-
-
Constructor Details
-
JointDef
-