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 to adjust the Anchor property, and by to adjust the ConnectedAnchor.
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.
Properties | Description |
---|---|
MaxLength | The maximum distance |
AutoCalcDistance | Whether 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.
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.
Properties | Description |
---|---|
EnableLimit | Whether to enable the limit of the joint |
LowerAngle | The minimum limit of the angle |
UpperAngle | The maximum limit of the angle |
EnableMotor | Whether to turn on the joint motor |
MaxMotorTorque | Maximum torque that can be applied to a rigid body |
MotorSpeed | Desired motor speed |
When motor speed is enabled, the jointed rigid body will try to gradually accelerate to the desired speed.
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.
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.
Properties | Description |
---|---|
Angle | Direction of sliding |
AutoCalcAngle | Automatically calculates the sliding direction based on the two rigid bodies connected |
EnableMotor | Whether to turn on the joint motor |
MaxMotorForce | The maximum force that can be applied to the rigid body |
MotorSpeed | Desired motor speed |
EnableLimit | Enables or disables the distance limit of the joint |
LowerLimit | The minimum value that the rigid body can move |
UpperLimit | The maximum value that the rigid body can move |
SpringJoint2D
Click Add Component on the Inspector panel and enter SpringJoint2D to add a spring joint.
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.
The Wheel Joint is used to simulate the wheels of a motor vehicle.
Properties | Description |
---|---|
Angle | Wheel vibration direction |
EnableMotor | Whether to enable the joint motor |
MaxMotorTorque | The maximum torque that can be applied to the rigid body |
MotorSpeed | Desired motor speed |
Frequency | Elasticity factor |
DampingRatio | Damping, indicating the resistance to return to the initial state after joint deformation |