2D Joint

    Click the Add Component button on the Inspector panel and enter the component name of the 2D joint.

    Common Properties of Joints

    Although each joint has different representations, they also share some common properties:

    Each joint needs to connect two rigid bodies to perform its function. We consider the rigid body hanging under the same node of the joint as the joint’s home end, and ConnectedBody as the rigid body on the other end. Usually, each rigid body picks a location around itself and sets it as an anchor point. Depending on the type of joint component, the anchor point determines the center of rotation of the object, or a coordinate point used to maintain a certain distance, etc.

    The CollideConnected property is used to determine whether the rigid bodies at the ends of the joints need to continue to follow the regular collision rules.

    If you are now going to make a ragdoll, you might want the thighs and lower legs to partially overlap and then connect together at the knees, then you would set the CollideConnected property to false. If you are going to make a lift and want the lift platform and floor to collide, then you would set the CollideConnected property to true.

    Adjusting Anchor Points

    Anchor points can be adjusted in the scene by clicking and dragging the gizmo-a to adjust the Anchor property, and by to adjust the ConnectedAnchor.

    gizmo

    Click Add Component on the Inspector panel and enter DistanceJoint2D to add a distance joint.

    DistanceJoint constrains the rigid bodies at both ends of the joint to a maximum range. Beyond this range, the motion of the rigid bodies will interact with each other.

    Below this range, they will not interact with each other.

    dis

    PropertiesDescription
    MaxLengthThe maximum distance
    AutoCalcDistanceWhether to automatically calculate the distance between two rigid bodies connected by a joint

    FixedJoint2D

    Click Add Component on the Inspector panel and enter FixedJoint2D to add a fixed joint.

    Fixed Joint holds two points on two objects together based on their initial angles.

    fixed

    Properties

    HingeJoint2D

    Click Add Component on the Inspector panel and enter HingeJoint2D to add a hinge joint.

    A Hinge Joint can be seen as a hinge or peg, where the rigid body rotates around a shared point.

    hinge

    PropertiesDescription
    EnableLimitWhether to enable the limit of the joint
    LowerAngleThe minimum limit of the angle
    UpperAngleThe maximum limit of the angle
    EnableMotorWhether to turn on the joint motor
    MaxMotorTorqueMaximum torque that can be applied to a rigid body
    MotorSpeedDesired motor speed

    When motor speed is enabled, the jointed rigid body will try to gradually accelerate to the desired speed.

    motor

    Relative joints can be added by clicking Add Component on the Inspector panel and entering RelativeJoint2D.

    Relative Joint controls the relative motion between two rigid bodies.

    Properties

    SliderJoint2D

    Click Add Component on the Inspector panel and enter SliderJoint2D to add a sliding joint.

    slider

    With a Slider Joint, the angle between the two rigid bodies is fixed and they can only slide on a specified axis. The blue square in the figure below is subject to gravity but can actually only move in the set direction due to the constraints of the joint.

    PropertiesDescription
    AngleDirection of sliding
    AutoCalcAngleAutomatically calculates the sliding direction based on the two rigid bodies connected
    EnableMotorWhether to turn on the joint motor
    MaxMotorForceThe maximum force that can be applied to the rigid body
    MotorSpeedDesired motor speed
    EnableLimitEnables or disables the distance limit of the joint
    LowerLimitThe minimum value that the rigid body can move
    UpperLimitThe maximum value that the rigid body can move

    SpringJoint2D

    Click Add Component on the Inspector panel and enter SpringJoint2D to add a spring joint.

    spring

    The Spring Joint connects objects at the ends of the joint like a spring.

    Properties

    Click Add Component on the Inspector panel and enter WheelJoint2D to add a wheel joint.

    wheel

    The Wheel Joint is used to simulate the wheels of a motor vehicle.

    PropertiesDescription
    AngleWheel vibration direction
    EnableMotorWhether to enable the joint motor
    MaxMotorTorqueThe maximum torque that can be applied to the rigid body
    MotorSpeedDesired motor speed
    FrequencyElasticity factor
    DampingRatioDamping, indicating the resistance to return to the initial state after joint deformation