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
Elevating Game Experiences with Unreal Engine 5

You're reading from   Elevating Game Experiences with Unreal Engine 5 Bring your game ideas to life using the new Unreal Engine 5 and C++

Arrow left icon
Product type Paperback
Published in Sep 2022
Publisher Packt
ISBN-13 9781803239866
Length 760 pages
Edition 2nd Edition
Languages
Tools
Concepts
Arrow right icon
Authors (4):
Arrow left icon
Gonçalo Marques Gonçalo Marques
Author Profile Icon Gonçalo Marques
Gonçalo Marques
Devin Sherry Devin Sherry
Author Profile Icon Devin Sherry
Devin Sherry
David Pereira David Pereira
Author Profile Icon David Pereira
David Pereira
Hammad Fozi Hammad Fozi
Author Profile Icon Hammad Fozi
Hammad Fozi
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Chapter 1: Introduction to Unreal Engine 2. Chapter 2: Working with Unreal Engine FREE CHAPTER 3. Chapter 3: Character Class Components and Blueprint Setup 4. Chapter 4: Getting Started with Player Input 5. Chapter 5: Query with Line Traces 6. Chapter 6: Setting Up Collision Objects 7. Chapter 7: Working with UE5 Utilities 8. Chapter 8: Creating User Interfaces with UMG 9. Chapter 9: Adding Audio-Visual Elements 10. Chapter 10: Creating the SuperSideScroller Game 11. Chapter 11: Working with Blend Space 1D, Key Bindings, and State Machines 12. Chapter 12: Animation Blending and Montages 13. Chapter 13: Creating and Adding the Enemy Artificial Intelligence 14. Chapter 14: Spawning the Player Projectile 15. Chapter 15: Exploring Collectibles, Power-Ups, and Pickups 16. Chapter 16: Getting Started with Multiplayer Basics 17. Chapter 17: Using Remote Procedure Calls 18. Chapter 18: Using Gameplay Framework Classes in Multiplayer 19. Index 20. Other Books You May Enjoy

Importing the required assets

Unreal Engine allows users to import a wide range of file types for users to customize their projects. There are several import options that developers can tweak and play around with to match their required settings.

Some common file types that game developers often import are FBX for scenes, meshes, animations (exported from Maya and other similar software), movie files, images (mostly for the user interface), textures, sounds, data in CSV files, and fonts. These files may be obtained from the Epic Marketplace or any other means (such as the internet) and used within the project.

Assets can be imported by dragging and dropping them into the Content folder, or by clicking the Import button in the Content Browser area.

Now let’s tackle an exercise where we’ll learn how to import FBX files and see how this is done.

Exercise 2.03 – importing a character FBX file

This exercise will focus on importing a 3D model from an FBX file. FBX files are widely used to export and import 3D models, along with their materials, animations, and textures.

Follow these steps to complete this exercise:

  1. Download the SK_Mannequin.FBX, ThirdPersonIdle.FBX, ThirdPersonRun.FBX, and ThirdPersonWalk.FBX files from the Chapter02 | Exercise2.03 | ExerciseFiles directory, which can be found on GitHub.

Note

The ExerciseFiles directory can be found on GitHub at https://github.com/PacktPublishing/Game-Development-Projects-with-Unreal-Engine/tree/master/Chapter02/Exercise2.03/ExerciseFiles.

  1. Open the blank project we created in Exercise 2.01 – creating an empty C++ project.
  2. In the Content Browser area of the project, click Import:
Figure 2.10 – The Content Browser area’s Import button

Figure 2.10 – The Content Browser area’s Import button

  1. Browse to the directory of the files we downloaded in Step 1, select SK_Mannequin.FBX, and click on the Open button.
  2. Make sure that the Import Animations button is unchecked and click the Import All button. You may get a warning here stating that There are no smoothing groups. You can ignore this for now. With that, you have successfully imported a skeletal mesh from an FBX file. Now, we need to import its animations.
  3. Click the Import button again, browse to the folder we created in Step 1, and select ThirdPersonIdle.fbx, ThirdPersonRun.fbx, and ThirdPersonWalk.fbx. Then, click on the Open button.
  4. Make sure that the skeleton is set to the one you imported in Step 5 and click Import All:
Figure 2.11 – FBX Import Options

Figure 2.11 – FBX Import Options

  1. Now, you will see the three animations (ThirdPersonIdle, ThirdPersonRun, and ThirdPersonWalk) inside the Content Browser area.
  2. If you double-click on ThirdPersonIdle, you’ll notice that the left arm is hanging down. This means that there’s a retargeting issue. When the animations are imported separately from the skeleton, the Unreal Engine internally maps all the bones from the animation to the skeleton. However, sometimes, that results in a glitch. Let’s resolve this:
Figure 2.12 – ThirdPersonIdle UE4 mannequin animation glitch

Figure 2.12 – ThirdPersonIdle UE4 mannequin animation glitch

  1. Open the SK_Mannequin Skeletal Mesh and open the Skeleton Tree tab if it wasn’t opened previously:
Figure 2.13 – SK_Mannequin Skeleton Tree tab

Figure 2.13 – SK_Mannequin Skeleton Tree tab

  1. Under Options, enable the Show Retargeting Options setting:
Figure 2.14 – Show Retargeting Options

Figure 2.14 – Show Retargeting Options

  1. Now, inside the skeleton tree, reduce the spine_01, thigh_l, and thigh_r bones to enable better visibility.
  2. Now, select the spine_01, thigh_l, and thigh_r bones. Right-click on them and, in the menu, click the Recursively Set Translation Retargeting Skeleton button. This will fix the bone translation issues we encountered previously.
  3. Re-open the ThirdPersonIdle animation to verify the hanging arm has been fixed:
Figure 2.15 – Fixed ThirdPersonIdle animation

Figure 2.15 – Fixed ThirdPersonIdle animation

Note

You can find the complete exercise code files on GitHub in the Chapter02 | Exercise2.03 | Ex2.03-Completed.rar directory by going to the following link: https://packt.live/2U8AScR.

After extracting the .rar file, double-click the .uproject file. You will see a prompt asking Would you like to rebuild now?. Click Yes on that prompt so that it can build the necessary intermediate files, after which it should open the project in Unreal Editor automatically.

By completing this exercise, you’ve understood how to import assets and, more specifically, imported an FBX skeletal mesh and animation data into your project. This is crucial for the workflows of many game developers as assets are the building blocks of the entire game.

In the next section, we’ll look at the Unreal core classes for creating a game, how important they are for creating a game or experience, and how to use them inside a project.

You have been reading a chapter from
Elevating Game Experiences with Unreal Engine 5 - Second Edition
Published in: Sep 2022
Publisher: Packt
ISBN-13: 9781803239866
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