User Manual Joint Components

From Color Infection Wiki
Jump to: navigation, search


What is A Joint

(Some texts are copied from Box2D User Manual).

A joint connects 2 physics shapes. It will remove some degrees of freedom of the connected shapes.

Joint entities have some common configurable properties:

  • Shape 1: the connected shape 1.
  • Shape 2: the connected shape 2.
  • Collide Connected Shapes: whether or not the connected two shapes will collide in simulation. (In fact, if this property is false, any brother of Shape 1 will also not collide with any brother of Shape 2)
  • Breakable: breakable or not. Currently, only valid for distance and spring joints.

Each joint entity has two anchor points in fact. But for easy editing, some joint types only have one anchor points (hinge and weld joints). In playing, the second anchor point will be created for these joint types automatically.

Joint Types

Spring

The spring joint acts just as a spring.

A spring entity has some more properties:

  • Static Length / Current Length: the ration of static length to current length.
  • Damping Ratio: the damping ration. The valid value is between 0.0 and 1.0.
  • Frequency Determined Type: how to determine the frequency of this spring.
    • Presets: weak, normal or strong, the frequency will be calculated automatically.
    • Custom Frequency (f): set the frequency directly
    • Custom Spring Constant (k): set the spring constant k. 2π*f = sqrt (k/m).
  • Break Extended Length: break extended length. This property is valid only if the breakable proeprty is true.

Distance

A distance joint will make the distance of the two connected shapes be constant. You can view as a distance joint as a very very hard spring.

A distance joint entity has one more property:

  • Break Delta Length: break delta length. This property is valid only if the breakable property is true.

Hinge

A hinge joint forces two shapes to share a common anchor point.

In the 2d world, you can think of a hinge joint as a distance joint which keep the distance of the two connected shapes be zero. But in 3d world, it is totally different.


A hinge joint entity has one more property:

  • Enable Limits: whether or not the angle limits are enabled
  • Lower Angle: the lower limit angle in degrees. This property is valid only if the Enable Limits property is true.
  • Upper Angle: the upper limit angle in degrees. This property is valid only if the Enable Limits property is true.
  • Back and Forth between Limits: back and forth? This property is valid only if the Enable Limits property is true.
  • Enable Motor: whether or not the motor is enabled
  • Motor Speed: the motor speed. This property is valid only if the Enable Motor property is true.
  • Max Motor Torque: max motor torque.

Slider

A slider joint allows for relative translation of two shapes along a specified axis. It prevents relative rotation between the connected two shapes.

A slider joint entity has one more property:

  • Enable Limits: whether or not the translation limits are enabled
  • Lower Translation: the lower limit translation. This property is valid only if the Enable Limits property is true.
  • Upper Translation: the upper limit translation. This property is valid only if the Enable Limits property is true.
  • Back and Forth between Limits: back and forth? This property is valid only if the Enable Limits property is true.
  • Enable Motor: whether or not the motor is enabled
  • Motor Speed: the motor speed. This property is valid only if the Enable Motor property is true.
  • Max Motor Force: max motor force.

Weld Joint

A weld joint makes two shapes have no relative movements.

Notice:

  • If you want to constrain all relative motions between the 2 shapes from start to finish in simulation, making them as brothers is more efficient than welding them with a weld joint.
  • One byproduct effect of dummy joint is you can use the dummy joints as shape friend link by set its Collide Connected Shapes property false.

Dummy Joint

As the name indicated, a dummy joint is dummy. There is no restrictions on the connected two shapes. In fact, a dummy joint are not that dummy. When its Collide Connected Shapes property is set false, then it can be viewed as a friend link, for the connected two shapes will not collide with each other.

More About Joints

In fact, all joint types can be abstracted with a super joint type concept. Besides the common configurable properties mentions above, the super joint type has the some more proeprties:

  • Anchor Relative Displacement Power Controlling
  • Anchor Relative Rotation Power Controlling
  • Anchor Relative Displacement Limits
  • Anchor Relative Rotation Limits

Create Joints

Below the create shape commands in the create command panel is the Create Joint Commands.

CreateJointCommands version phi.jpg

A joint will connect with 2 shapes apply some specific effects on the 2 shapes in simulating. Currently, there are 6 joint types: Hinge Joint, Slider Joint, Distance Joint, Spring Joint, Weld Joint and Dummy Joint.

  • A hinge joint attempts to make the 2 connected shapes rotate relative to each other about a fixed axis of rotation (From wikipedia). Here, in 2d world, the axis is perpendicular with the screen and through the hinge anchor point. To create a hinge, select the Create Hinge Joint Command (CreateHingeCommand version phi.png) and place the hinge entity at the position of the rotation axis in the world scene.
  • A weld joint attempts to constrain all relative motions between the 2 connected shapes. Creating a weld joint is much like creating a hinge joint, the difference is you must select the Create Weld Joint Command (CreateWeldCommand version phi.png) firstly.
  • A slider joint allows for relative translation (but no relative rotation) of two shapes along a specified axis. To create a slider, first select the Create Slider Joint Command (CreateSliderCommand version phi.png), then press mouse to place the first anchor on the first shape to be connected then move and release mouse on the second shape to be connected to place the second anchor.
  • A distance joint attempts to constrain the distance of 2 points on the 2 connected shapes be constant. Creating a distance joint is much like creating a slider joint, the difference is you must select the Create Distance Joint Command (CreateDistanceCommand version phi.png) firstly.
  • A spring joint acts as a spring connected between the 2 conected shapes. Creating a spring joint is much like creating a slider joint, the difference is you must select the Create Spring Joint Command (CreateSpringCommand version phi.png) firstly.
  • As the name hints, a dummy joint applies nothing on the 2 connected shapes. Dummy joints are useful for some APIs. Creating a dummy joint is much like creating a slider joint, the difference is you must select the Create Distance Joint Command (CreateDummyCommand version phi.png) firstly.