Professional Services
Order outsourcing

How to Set Up Procedural Turret Animation with Unreal Engine's Control Rig

Roy Livne showed us how the procedural turret animation was created using Control Rig in Unreal Engine 5, shared some tips for beginner artists, and discussed his career as an Unreal Engine Developer and Instructor.


Hi everyone,

My name is Roy Livne, and I am an Unreal Engine game developer and authorized instructor. I got into 3D art and game development about 5 years ago, after working as a software developer for roughly 11 years. I wanted to make a career change and was always into characters, games, creative, and interactive things, such as toys and games, etc. I just wasn't sure what it was I wanted to do.

I thought that animation was something I wanted to try, and after doing some research, I found a college in my hometown that had a pretty good 3D animation course, which was about 1.5 years long. There, they taught me all the basics of 3D, from modeling to animation. I learned Maya, ZBrush, Photoshop, and Substance Painter. That's where I also first heard about Unreal Engine and immediately felt a connection. At that time, I thought I wanted to be a 3D artist and focus more on the artistic side – I practiced sculpting, modeling, and texturing.

I managed to find a job in a small animation studio where I worked as a 3D Generalist—I did everything from modeling to rigging to animation. It was mainly short product visualizations and promotional videos for different companies. The first rig I ever had to do was a parrot, which was a significant challenge. Making a rig with wings is super hard if it's your first. After that experience, I decided I wanted to know how to rig properly and focused on that. I took some really great online courses where I learned how to rig.

Following this, I was very much drawn to real-time rendering and have always wanted to work in the gaming industry. I ended up leaving the animation studio to pursue my Unreal Engine goals. My first job in Unreal was at a startup that developed a VR game/platform where I worked as an Unreal tech artist. The company eventually closed down, but I gained valuable experience.

Following that, I got a chance to replace a teacher at the same college where I studied, to teach game development in Unreal, and I ended up teaching Unreal there for quite a long while. During that time, and because I had more experience, I found a position as an Unreal game developer in a metaverse startup, and I have been working there ever since. I had the opportunity to become an authorized instructor for Epic Games through one of my colleagues at work, which was a major milestone in my career.

I love learning about many areas of CG in Unreal and always try not to limit myself to just one area. Nevertheless, I try to focus on the things that interest me the most, such as programming, characters, and rigging. This is where I started playing around with Control Rig.

Unreal Engine

My first encounter with Unreal Engine was in the school where I learned 3D. I immediately connected with it. There I learned the basics (game design, level design, blueprints, etc.). I always wanted to work in the gaming industry, especially with characters, and I wasn't aware of how powerful Unreal Engine and its community are – the way it is user-friendly to people who don't necessarily come from an engineering background and how fast you can make something that looks good.

The most effective way I got to learn Unreal was mainly by just doing personal projects and through work. I believe that learning by doing is the best approach. As I mentioned earlier, I got into rigging and decided to learn it properly, so I did a few courses in CGMA – the first one was "Intro to Rigging," which was awesome, and the second one was "Rigging for Games," which was super challenging and interesting. In addition, I took a course in Puppeteer Lounge, which is another online school. After that, I felt like I could continue on my own and move to other areas. I took a couple of workshops at Vertex School; one was "Realtime VFX in Unreal," where I learned about Niagara and integrating Houdini, and the other one was "Environment Tech Art for Unreal Engine Artists," where I learned a lot about optimization techniques, shaders, creating tools, lighting, etc.

I think one of UE5's advantages is that it has so many tools and is very intuitive to get started with the basics. There are so many resources that you can basically find anything you need to know by yourself. Also, the Unreal community and Epic Games itself are very helpful and cooperative. Another advantage is that you can get up and running relatively fast with a prototype for any project you can think of, and it looks great very quickly, which is a great advantage.

Being Unreal Engine Developer & Instructor

In my current job, I get to work on a variety of projects for different platforms (PC, mobile, VR, etc.), so I learn a great deal. I can try out many plugins and work on tasks that involve not only programming but also general 3D-related work such as optimizations, creating materials, rigging, etc. I have gained a lot of experience with the different nuances of building for various platforms and how to tackle issues that arise – and they do arise. Many times, things don't work as they should, and I need to find creative ways of solving problems.

While working as an instructor, I have to find ways to create interesting content and lectures that can engage the students and challenge them, like coming up with exercises and projects. When teaching a class that is big and consists of different levels of knowledge, it's important to balance the material so that everyone can benefit and understand.

I think the skills one should have to become a successful instructor are, first, technical, then the ability to self-learn and problem-solve. Also, patience and enthusiasm to teach, as well as creativity to come up with interesting lessons and exercises, are very important.

As for tutorials, I would recommend the Unreal Engine Developer Portal; there are a ton of resources there to get started, and also some great YouTube channels such as Ryan Laley and Virtus Learning Hub. I would also go to the Unreal Marketplace and download some of the starter packs to delve inside and try them out, such as the Lyra Starter Game and the Content Examples.

Procedural Walking Turret

I came up with this procedural animation because I am developing my own indie game, and I just had to have a robotic spider as an enemy. Now, I am no animator; I did try to animate something myself, but it just wasn't right. There are some resources out there like Mixamo, but that is purely for bipedal characters, and I think we've all used those animations already. I needed something more interesting and believable. A friend suggested I try out procedural animations, and I remembered that I saw a tutorial about 2 years ago that was about Control Rig, and at the end of it, there was a short demonstration of a scorpion robot that was moving procedurally. That gave me the motivation to create one myself.

First, I found a model that I liked and was free to use on Sketchfab – even though I am pretty solid at modeling, the focus was on having the animation done. (Thanks to Nghia Nguyen for the Spider Bot model.) I first created the skeleton in Maya and imported it into Unreal but later decided to go back and redo it entirely inside Unreal to use the new Skeleton Editor feature. The process is almost the same, but the tools and interface are different.

This is the rig in Maya:

First, I imported the mesh into Unreal and then turned it into a skeletal mesh.

Here is the rigging process:

First, I create bones (or joints, as they are commonly known). Next, I start the skinning process, which involves connecting the bones to the mesh. (This is a very simplified explanation, as rigging is a complex topic in itself.)

After that, you right-click on the skeletal mesh and create a Control Rig. I then created an Animation Blueprint and hooked the Control Rig to it.

Here is the procedural animation process:

Control Rig is evaluated using a few different methods called solvers.

Construction event – this occurs once, before everything else, and is used to initialize elements.

Forward Solve is the solve direction used for driving your skeleton with controls, variables, and other rig elements. It is the primary solve direction for the Control Rig, as it is used when animating your Control Rig within Sequencer and Animation Blueprints.

Backward Solve is the inverse of Forward Solve and is used to bake animation from animation sequences onto a Control Rig in the Sequencer. I didn't use it in my setup.

In a nutshell, the main idea behind the procedural animation is to use inverse kinematics (IK) to determine where the spider's legs touch the ground (using a technique called 'sphere trace by channel'), save those values, and then calculate the spider's walking speed so we can estimate where the legs "want to be" next. Additionally, we lift them off the ground between each move, while moving the pelvis in a natural manner.

First, I pick a point above the leg bone and project a line that ends at a point below that leg bone inside the floor.

Using this node

The point where the line trace hits is the ground, and that is where I want the leg to be, touching the ground. I then save that location as a vector in an array – for those not familiar with programming terminology, it's another name for a list.

Here is an example of how I do that in the construction event:

Here is an illustration to show the line trace concept:

Just to explain to anyone who is not familiar with these basic rigging concepts:

There are two methods of moving bones in rigging: FK or IK (Forward Kinematics and Inverse Kinematics).

FK (Forward Kinematics) is when you move a joint, and all its child joints follow in a linked chain, but each joint can also move independently.

IK (Inverse Kinematics) is when you move an end effector, like a hand or foot, and the system automatically calculates the angles and positions of the preceding joints in the chain to achieve that end position.

Forward Kinematics

Inverse Kinematics

In Control Rig, adding IK to a chain of bones is accomplished using the 'Basic IK' node.

Now you can move the spider, and its legs and pelvis will move according to where they touch the floor.

Next, I calculate the velocity using the equation Velocity = Distance/Time and apply it to the locked location of the legs.

Next, I calculate the location to which the legs will "want" to move, which is the same locked locations we saved but multiplied by the velocity we calculated.

Now we need to move each leg at a different time because currently, they all move together. So, I calculate a separate time for each leg. For that, I used another list (array) of floats that will increase each second, multiplied by the velocity – this is the function that I wrote:

Next, each time the leg moves, I raise it using a curve.

To achieve fluid movement for the spider's pelvis and make the animation look more convincing, I used a spring interpolation, which turns the pelvis into a "spring," giving it a bouncy movement. This is done using the Spring Interpolation node.

It's a personal project that has been ongoing for a while. It will be a third-person adventure game set in a dystopian future where the AI has developed awareness and decided to take over humanity. During that process, it created hybrids between man and machine, but a few of them had been left with a human heart by mistake. Deciding to fight their creators, a group of heroes takes on the job of saving mankind. 

Its style is going to be similar to games like "Ratchet and Clank" and "Crash Bandicoot." 

Here is a short video of using the turret animation with the main character that I just made: 

And this is an older demo that I did in an early stage.

Control Rig

The main update in Control Rig in version 5.3 is the Skeleton Editor, which allows us to create the skeleton and skin it entirely inside Unreal. Additionally, there is an option to convert a static mesh into a skeletal mesh, a task previously done outside of Unreal. Another feature is the Python API, which is crucial for rigging to create tools for automating and simplifying the process. The Deform option is also useful, offering many possibilities for creating different deformations to the mesh. The capability to perform all these tasks within Unreal is a significant advancement.

It took me about two months of trial and error, watching tutorials, reading documentation, and going back and forth to find the right values. I needed to find time between my full-time job, so it was done mainly on weekends and evenings, basically whenever I could find time.

The main bottlenecks were firstly trying to translate my knowledge of rigging from a different software to using that in Unreal. The ideas are the same, but the techniques are different.

I had one issue where the legs of the spider were touching the ground and everything was working, but sometimes they were intersecting with objects, for example, when going up a ramp and then getting down – see photo:

After a while of pulling out hair, I realized that I was line tracing straight above the leg joint. Instead, I figured out I needed to find a spot between the pelvis and the leg – so I used interpolation between these two points:

Another bottleneck was that there were a few things that changed from earlier versions that you could get away with, but now you can't. For instance, if you want to read a value from a list (array) at a certain index, you need to remember to set the array every time you add a value to it, or you will get an error. This had me pulling my hair for a while. I finally solved it after doing some Googling and searching online – I found out someone had encountered the same problem, and that's how I fixed it.

Tips for Beginners

Which topic to focus on really depends on your interests and goals. If you are more interested in the animation process, then I would focus on learning how to use the animation tools in Unreal, such as the Sequencer and the Animation Editor. If you are more interested in rigging, then focus on creating rigs with the Control Rig.

For someone who is a total beginner at rigging, I would recommend first studying the basics of rigging and the main principles, then applying that with the Control Rig tools. Even though the tools inside Unreal are very approachable, I think it's very important to know and understand the basic principles and the theory as well.

There are a lot of nodes and functionality that's inside Control Rig, and coming with a good solid knowledge of the different principles of rigging will make your life easier.

First, I would recommend watching this tutorial:

Secondly, I recommend getting the Control Rig sample pack from the Unreal Marketplace. It has some pretty good rigs that were created, and you can start breaking apart and learning how they work. It's called "Control Rig Sample Pack."

There is another tutorial which is older but still shows good info:

And also, I recommend looking in the Unreal Developers Community Portal, as there are loads of resources there. Here is one of them.

There is this new course by Lincoln Margison on Udemy, too. This course is very good for taking your first steps at rigging.

Roy Livne, Unreal Engine Game Developer & Authorized Instructor

Interview conducted by Theodore McKenzie

Join discussion

Comments 0

    You might also like

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more