Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Unreal Engine 4.X

You're reading from   Mastering Unreal Engine 4.X Master the art of building AAA games with Unreal Engine

Arrow left icon
Product type Paperback
Published in Jun 2016
Publisher Packt
ISBN-13 9781785883569
Length 384 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Muhammad A.Moniem Muhammad A.Moniem
Author Profile Icon Muhammad A.Moniem
Muhammad A.Moniem
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Preparing for a Big Project 2. Setting Up Your Warrior FREE CHAPTER 3. Designing Your Playground 4. The Road to Thinkable AI 5. Adding Collectables 6. The Magic of Particles 7. Enhancing the Visual Quality 8. Cinematics and In-Game Cutscenes 9. Implementing the Game UI 10. Save the Game Progress 11. Controlling Gameplay via Data Tables 12. Ear Candy 13. Profiling the Game Performance 14. Packaging the Game Index

Retargeting animations

When I was choosing my characters, I picked the bear as my main game enemy. The choice came as a result of several factors. First, I liked the two attack animations that the bear has, it is very strong and has great key poses. Second and most importantly, the bear has no idle, walk, or run animations, and it's a good opportunity to check some of the Unreal tricks of duplicating animations from a skeleton to another different skeleton. This is called animation retargeting.

By default, when you import an animation for the first time, you will be asked to either use an already made skeleton asset from within the project, or to import the asset skeleton and build a skeleton asset out of it. For several animations of the same character, you will keep reusing the skeleton asset, but once you import a different character it'll force Unreal to create its own skeleton structure asset.

Now, as you might have noticed, each enemy of the Infinity Blade assets has its own skeleton assets, and our main focus here is to somehow get an idle animation alongside the running and/or walking animation for the bear. As you noticed, the bear has only two animations!

Retargeting animations

Now if you check what the closest animal is in body structure and skeleton hierarchy to the bear (and included in the assets), you will find the wolf asset. This asset has all that we need and more, it is very similar to the bear, and it has walking and idle animations, alongside other attached animations. The goal now is to retarget and close the walk and idle animations of the wolf and use them with the bear. After we finish that, we will retarget the walk animation once more, and change its speed factor in order to make it look like a running animation (a run is just a fast walk, huh?!), and that will save us the time of creating animations or assets from scratch. It will even save us more time if we want to send the bear asset back to Maya or 3dsMax to add some more animations for it.

Retargeting animations

The retargeting process is very simple; you can consider it as the following steps:

  1. Create an intermediate skeleton structure (called Set up Rig).
  2. Define the Source character skeleton (the wolf), based on the intermediate skeleton.
  3. Define the Target character skeleton (the bear), based on the intermediate skeleton.
  4. Retarget the required animation from the source into the target.

While we have a plan, let's get started in retargeting the animation. By opening the wolf skeleton asset, you will be inside the Persona editor. At the top there is a button called Retarget Manager. Hit it!

Retargeting animations

That will open the retargeting window for you; it is very simple, you need to create the skeleton by hitting Add New Retarget Source and then start assigning the wolf bones to the correct slots of the intermediate skeleton. You don't have to fill them all, you just need the animated bones to be assigned. Keep in mind, at any time, if you need to assign more bones that are not shown on the intermediate skeleton, you can press the Show Advanced button in order to display more bone options to assign. Nevertheless, from my experience with this wolf skeleton asset, those basic bones are enough.

After assigning the bones you should end up with something like the following:

Retargeting animations

Now, let's do the same thing with the bare bones. Open its Persona, and start assigning the bones to an intermediate skeleton. There are two things you might notice here: the wolf has one more bone within the legs, and it fits its real bone structure. In addition, the wolf has a tail, while the bear skeleton has no tail. That will not affect us too much, but make sure not to assign something wrongly. Feel free to ignore those extra bones from the wolf.

After assigning the bones, you should end up with something like the following:

Retargeting animations

Now it is time to do the final step, which is retargeting (cloning) the animations themselves from the source to the target. By accessing the animation assets of the wolf (under the animations folder within the wolf folder), you can select any of the animations (let's start with the idle animation); right-click and, from Retarget Anim Assets, choose Duplicate Anim Assets and Retarget. That's enough to take you to the final step of retargeting.

Retargeting animations

The Select Skeleton window will show up. This window will already have the retargeting source skeleton selected and display its character. It requires you to select the target (which is the bear), by selecting the bear skeleton (the one we have already assigned to the intermediate skeleton) and hitting Select; that will copy the animation right away for you, and set it to the animation for the bear.

Retargeting animations

Now it's time to rename the animation to something which makes more sense. The new animation will still have the name of the wolf, but it has a thumbnail of a bear character, and it is only playable over the bear skeleton; thus you probably need to rename it bear.

Do retarget all the animations you want, but don't forget to rename them and move them to the bear folder, just to keep things organized.

After you are done duplicating/retargeting all the animations you want, I would recommend you duplicate the walking animation again for the bear, but this time name it run. After you have done the duplication, double-click on the animation asset. That will run Persona again, but this time it will be activating the Animation tab, not the Skeleton tab like before.

From the left side, there is a panel called Anim Asset Details. Make sure to set the Rate Scale under the Animation tab to 2.0, which will change the speed of this animation asset. By having it run fast, it really looks like a real run. Now we have managed to get lots of animations working and running for the bear, without the need to do a single animation frame!

Retargeting animations
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image