Using Articulation Bodies in Unity

Simon Pham
4 min readAug 3, 2024

--

In today’s blog post, let’s discuss Articulation Bodies in Unity.

What is an Articulation Body?

In the previous blog post, we talked about joints and how they can be used in game development. An Articulation Body is sort of like a joint and a Rigidbody mixed into one component. Articulation Bodies allow you to build interesting things, like robotic arms or kinematic chains, with GameObjects within the same hierarchy.

Demonstration

Overview

In today’s blog post, we will expand on the demo built in the previous blog post about the machinery simulation. Our objective is to use the robotic arm to move the platform to the right side so that the hydraulic piece above it can reach its full range of motion.

The arm and platform are being highlighted

The arm can be broken down into smaller parts, as shown below:

And here is the screenshot of its hierarchy:

Base

First, I’m going to add an Articulation Body component to the Base object. By default, the very first Articulation Body component is set as the root body of the articulation.

Next, I’m going to check the Immovable property to ensure that the base object will not be tipped over by any force.

Joint 1

I’m going to add an Articulation Body component to the Joint 1 object.

One of the most important things is to decide which type of joint you want to use for a GameObject. There are four joint types: Fixed, Prismatic, Revolute, and Spherical. You can read more about this topic in the Unity official documentation. For this joint, I’m going to choose Revolute because I want it to rotate around an axis.

The next step is to decide which type of Articulation Drive to use. There are also four drive types: Force, Acceleration, Target, and Target Velocity. Since I want the arm to move on its own when the Target Velocity property is set, I’m going to select the Target Velocity option. You can also read more about this topic here.

Next, I’m going to rotate the joint a little bit to the left like this:

Joint 2

First, I’m going to select the remaining objects and add an Articulation Body to all of them so I won’t have to repeat this for each object.

Next, I’m going to set the Articulation Joint Type to Revolute and the Drive Type to Target. To rotate it around the Y axis, I’ll change the Anchor Rotation to 90 on the Y axis instead of the Z axis.

To test this, I’m going to manually adjust the Target value in Play mode:

Joint 3

I want this joint to always point downward, so I’m going to choose the Revolute option and set the Anchor Rotation to 90 on the Y axis and 0 on the other axes. Next, I’ll set the Motion property to Limited and adjust the Lower limit and Upper limit to -90 and 90 degrees, respectively. Additionally, I’m going to set the Stiffness to 50.

And here’s the current result:

Joint 4

Since I want this joint to move side to side, I’m going to choose Revolute but keep the Anchor Rotation value at 90 degrees on the Z axis and 0 on the other axes. Next, I’m going to set the Motion property to Limited and adjust the Lower limit and Upper limit to 0 and 180 degrees, respectively. Additionally, let’s set the Stiffness to 25 and leave the Drive Type as Force.

And here it is in action:

Joint 5 and Claws

Similarly to Joint 4, I’m going to choose Revolute, set the Anchor Rotation to 90 degrees on the Z axis only, limit the Motion between 0 and 180 degrees, set the Stiffness to 25, and leave the Drive Type as Force.

For the claws, I’m going to leave everything as is.

That’s everything we need to set up. You can certainly create scripts to control every part of the arm, but I’m going to manually control it by adjusting the Target/Target Velocity values for Joints 1 and 2.

And here’s the result:

--

--