Manual

Manual

Joints

A joint holds two bodies together: a door on its hinge, a drawer on its runners, a wheel on a car, a rope, a spring, a weld. This page covers what every joint shares, each of the six joints, placing their anchors in the Scene view, and joints that break.

How a joint holds two bodies

A joint is a component on one of the two bodies. It holds:

  • the body it is on: the nearest Rigidbody 2D at or above its entity. Added in the editor where there is none, the joint brings a Rigidbody 2D to its entity.
  • its Connected Body: another entity with a Rigidbody 2D, or one under it, dragged from the Hierarchy into the slot. Left empty, the joint holds its own body to a point in the world.

Every joint has these fields:

FieldWhat it does
Connected BodyThe other body it holds; none for a point in the world.
Enable CollisionWhether the two bodies still collide with each other. Off to begin with.
Auto Configure Connected AnchorMakes the connected anchor where the anchor is, as the joint is made, and then shows where that was. On to begin with, except on the Distance and Spring joints.
AnchorWhere it holds its own body, in its entity's own units.
Connected AnchorWhere it holds the other body, in that entity's own units, or in the world's where there is no Connected Body.
Break ForceThe force it breaks at, in newtons. Infinity, never, to begin with.
Break TorqueThe torque it breaks at, in newton meters. Infinity to begin with.

The joint is made as the game starts playing, or as it is added while it plays. Where it works a value out as it is made, such as the connected anchor, it writes the value into its fields, so you can see what it was made with.

While a joint's entity is picked, the Scene view draws it in light blue: a ring at each anchor, the line between them, and the way a slider or a wheel's suspension moves.

Hinge Joint 2D

Two bodies turning about one point, as a door on its hinge or a wheel on its axle.

FieldWhat it does
Use MotorThe motor turns it.
Motor SpeedHow fast the motor turns this body against the other, in degrees a second, anticlockwise.
Max Motor TorqueThe most torque the motor turns it with, in newton meters.
Use LimitsIt stops turning past Lower Angle and Upper Angle.
Lower Angle, Upper AngleThe least and the most it turns, in degrees from where it was as it was made, each within 178 either way. They start at 0 and 90.

Slider Joint 2D

Two bodies sliding along a line, as a drawer or a lift, kept at the angle they were at.

FieldWhat it does
AngleWhich way it slides, in degrees anticlockwise from the world's X as it is made. The line goes through Anchor, and turns with the connected body afterward.
Use MotorThe motor drives it along.
Motor SpeedHow fast the motor drives it, in meters a second.
Max Motor ForceThe most force the motor drives it with, in newtons.
Use LimitsIt stops sliding past Lower Translation and Upper Translation.
Lower Translation, Upper TranslationThe least and the most it slides, in meters from where it was made. They start at 0 and 1.

Wheel Joint 2D

A wheel on a car. The joint goes on the car, and its Connected Body is the wheel, which turns freely about its Connected Anchor and is held to the car by a suspension, a spring along a line.

FieldWhat it does
Suspension Damping RatioHow quickly the suspension's bounce dies away: 0 never, 1 at once. 0.7 to begin with.
Suspension FrequencyHow stiff the suspension is, in bounces a second. 2 to begin with.
Suspension AngleWhich way the suspension moves, in degrees from the world's X as it is made: 90, to begin with, is straight up. It turns with the car afterward.
Use MotorThe motor turns the wheel.
Motor SpeedHow fast the motor turns the wheel against the car, in degrees a second, anticlockwise.
Max Motor TorqueThe most torque the motor turns the wheel with, in newton meters.

With no wheel, it holds the car to the world.

Distance Joint 2D

Two bodies kept a distance apart, as by a rod, or no further apart, as by a rope.

FieldWhat it does
Auto Configure DistanceMakes the distance how far apart the anchors are as the joint is made, and then shows it. On to begin with.
DistanceHow far apart the anchors are kept, in meters.
Max Distance OnlyLets the bodies come nearer, as on a rope, and keeps them no further apart than Distance.

Spring Joint 2D

Two bodies pulled toward a distance apart by a spring.

FieldWhat it does
Auto Configure DistanceMakes the distance how far apart the anchors are as the joint is made. On to begin with.
DistanceHow far apart the spring pulls the anchors, in meters.
Damping RatioHow quickly the spring's bounce dies away: 0 never, 1 at once.
FrequencyHow stiff the spring is, in bounces a second. 0 is as stiff as a rod. 1 to begin with.

Fixed Joint 2D

Two bodies held together as they were as it was made, as if welded.

FieldWhat it does
Damping RatioHow quickly its give dies away: 0 never, 1 at once.
FrequencyHow stiffly it holds, in bounces a second. 0, to begin with, holds as stiff as there is; more lets it give like a spring.

Edit Joint

Edit Joint, the button at the top of a joint's section, places its anchors in the Scene view. A dot on Anchor moves where the joint holds its own body. A second dot, on Connected Anchor, moves where it holds the other, shown only while Auto Configure Connected Anchor is off. Each drag is one Ctrl+Z. Escape, the button again, choosing a tool, or picking something else ends editing.

When a joint breaks

A joint breaks when it holds with more force than its Break Force, or more torque than its Break Torque, in a step. It is taken off its entity as the step ends, and reported in JointsBroken, which a system reads as it reads what touched (see Contacts and queries):

Physics2D physics = context.Services.Get<Physics2D>();foreach (JointBroken2D broke in physics.JointsBroken){    Log.Info($"{broke.Joint} joint on {broke.Entity} broke, holding {broke.Force} N and {broke.Torque} N·m");    // broke.ConnectedBody is the other body it held, or 0 for a point in the world}

In the Scripting API