Unity Physics — Joints, Hinges and Springs.. Oh My

Sean Duggan
4 min readJun 6, 2024

Unity has a wide variety of joints that you can make use of for physics interactions.

No, not that sort.

Also, not that sort.

Yeah, a bit more like that. Broadly speaking, there are four specialized joints, and one broad one that can be configured to do the tasks of the other four joints.

Fixed Joints

Fixed Joints are the simplest ones. The basic idea is that they don’t move. Imagine it like using Krazy Glue.

Much like using glue, with enough force (laterally or torque), the connection can break (if you don’t set its strength to infinite). You can also programmatically break the joint. If you were following the VR lessons, you may remember me using it with a drawer so that the player would grab the handle, not the drawer itself, to avoid accidentally ripping the drawer out of the cabinet.

Hinge Joint

A Hinge Joint essentially allows rotation along a single axis at a single point like, well, a hinge. You can constrain the range of motion, add a spring force that tries to return it to a particular rangle, or add a motor force that will apply force to spin it in a particular direction (it’s not recommended to mix those two…). And, as with all of the joints, you can set a break force, an easy way to have something like a gate that will swing open and shut, but with sufficient force, gets knocked off of its hinges, say if you have a car hit it.

Spring Joint

A Spring Joint, like the name indicates, allows a certain amount of movement between two points, as governed by a spring equation. Not too much to say about this one, other than that my personal experience is that this is a tricky one to make look right without adding some additional structures to make the objects appear linked.

Character Joint

A Character Joint is basically a ball-and-socket joint that can’t change position of the joint, but can rotate on any axis. Of course, there are options to limit that movement.

The twist axis (visualized with the orange access on the gizmo) gives you most control over the limits as you can specify a lower and upper limit in degrees (the limit angle is measured relative to the starting position). A value of –30 in Low Twist Limit->Limit and 60 in High Twist Limit->Limit limits the rotation around the twist axis (orange gizmo) between –30 and 60 degrees.

The Swing 1 Limit limits the rotation around the swing axis (visualized with the green axis on the gizmo). The limit angle is symmetric. Thus a value of 30 will limit the rotation between –30 and 30.

The Swing 2 Limit axis isn’t visualized on the gizmo but the axis is orthogonal to the two other axes (that is the twist axis visualised in orange on the gizmo and the Swing 1 Limit visualised in green on the gizmo). The angle is symmetric, thus a value of 40 will limit the rotation around that axis between –40 and 40 degrees.

For each limit, you can set Bounciness, Spring, Damper, and Contact Distance values. And, of course, you can set breaking forces again.

As one might guess by the ball-joint setup, a common usage is rag-dolls.

Configurable Joint

Alright, so that’s a lot of specialized joints. What’s left? Well, the Configurable Joint is basically Unity throwing their hands up and saying, “You want to be able to change all of the things? Here.” There’s a fairly comprehensive guide here, and let’s just say that it goes on for some time.

One thing here, which isn’t covered by any of the other joint types, is allowing lateral movement along an axis, like a drawer (like this VR project) or a hydraulics system.

Overall

One quick note is that, while it’s intuitive to think of the joints as connecting two Rigidbodies, they can also anchor to the world itself, which is what happens when you don’t assign a Connected Body.

--

--