In these lessons, you will learn how to import 3D characters and motion capture animation clips.
In these lessons, you will learn how to import 3D characters and motion capture animation clips. We will explore the initial setup of the third-person character as well as a non-player character (NPC). By the end of these lessons, you will be able to control imported character models.
You will learn how to create a third-person player using the Character Controller component and set up a smooth follow camera that incorporates Unity’s Cinemachine components. Then you’ll code player input controls to move, turn, and access the default input system. A non-player character will also be configured to work with Unity’s AI Navmesh system, setting up a Navmesh area with static areas not to be navigated and an AI “brain” that will control the NPC’s movement around the Navmesh areas. You’ll use C# code extensively for both the third-person player as well as the non-player character, learning new coding skills such as accessing the character controller component.
Learning Objectives
- Understand how to set up imported 3D characters and motion files
- Demonstrate how to create a third-person player with input controls
- Know how to work with a non-player character utilizing the Navmesh system
- Explain how to code player and NPC motion using mouse and keyboard inputs
Skills you’ll gain
Character AnimationVirtual Camera SystemsWhat You'll Learn
- Import 3D characters and motion capture animation clips, and control imported character models
- Create a third-person player using the Character Controller component
- Set up a smooth follow camera using Unity's Cinemachine components
- Code player input controls to move, turn, and access the default input system
- Configure a non-player character (NPC) to work with Unity's AI Navmesh system, including static non-navigable areas and an AI "brain"
- Code player and NPC motion using mouse and keyboard inputs with C#
Key Takeaways
- The course covers importing 3D characters and motion capture animation clips and setting up both a third-person character and a non-player character.
- A third-person player is created with the Character Controller component and a smooth follow camera built using Unity's Cinemachine components.
- The NPC is configured with Unity's AI Navmesh system, defining a Navmesh area, static areas not to be navigated, and an AI "brain" to control NPC movement.
- C# code is used extensively for both the third-person player and the NPC, including accessing the character controller component.
- Player and NPC motion is coded to respond to mouse and keyboard inputs.
Frequently Asked Questions
What will I learn in this course?
You will learn to import 3D characters and motion capture clips, create a third-person player with the Character Controller component, set up a follow camera with Unity's Cinemachine, code player input controls, and configure a non-player character using Unity's AI Navmesh system.
Does this course use C# programming?
Yes. C# code is used extensively for both the third-person player and the non-player character, including learning to access the character controller component.
How is the player camera handled?
You set up a smooth follow camera that incorporates Unity's Cinemachine components.
How does the non-player character move?
The NPC is configured to work with Unity's AI Navmesh system, with a Navmesh area, static areas that are not to be navigated, and an AI "brain" that controls the NPC's movement around the Navmesh areas.
What topics do the lessons cover?
The lessons cover importing characters and motion capture, creating a third-person player, building a player controller in two parts, setting up an NPC, and setting up NPC AI.
Transcript
Show transcript (free preview lesson)
Transcript of the free preview lesson. Remaining lessons unlock with the full course.
Hello, welcome to this lesson in Unity. In these lessons, you will learn about character animation and programming interactions. Create a new scene and save it as characters. Choose Basic built-in and Save in the Scenes folder. Open your Assets folder and do not already have a textures folder Create one now. Check also you have an animations folder, if not Create one. Lastly, let's create a Mixamo folder. You can create your own 3D characters in humanoid animation using popular 3D content creation apps such as Maya, 3D Studio Max, and Blender to name a few. These characters and animation clips can then be exported using the Filmbox format and used in game engines. You can also import pre-made 3D characters and motion capture files from many asset sites on a web. One site for free access to a whole library of characters and the motion files is Mixamo. Mixamo is now owned by Adobe and to access the files you will need to register for a free Adobe account, then login using your Adobe credentials. Open a web browser and navigate to www.mixamo.com, login using your Adobe credentials. You will be greeted by an asset browser for characters and motion capture animations. On a side note, you can upload 3D characters that you created yourself and have Mixamo at its skeleton so you can use the animation files with it. Select a character you would like to represent your player by clicking the Characters menu. There are over 100 to choose from. For this lesson, I'm going to search for Y and select a Ybot. If there is an animation already running on this character, just click the X next to the animation name. You should then see the character in the classic T-Pose. The T-Pose has discovered my motion capture studios to be the best starting point for any humanoid animation and allows binding the 3D mesh to a skeleton control easier than in other positions. Click download, then download. You should only see the T-Pose as an option. To keep track of your files, open a Downloads folder and rename the Ybot file you just downloaded or rename this to Player. Let's choose one more character for the NPC or non-player character. We'll search Ninja, we'll select a Ninja character, we'll confirm the T-Pose and download, we'll rename this one NPC, return to the Mixamo website and click the animations menu. We only need a few motion capture animations for our game. First we'll search for idle and we want a neutral idle, you can scroll down and select it or you type in the search, we'll select it. First a character switch from the T-Pose to a standing slightly moving idle animation. Click download and the options menu change the frames per second to 60 and set skin to without skin, we just want the animations, we already have a rigged and skin models downloaded. Click download, the file name should match the action and we'll leave it as it is. Now we'll search for walk, in this case we want the standard walk, you can scroll down and find it and select it, oh we can type it in. Now the character is seen walking in the straight line and the motion repeats from the start position. However, we will be controlling the forward motion with input controls to the player and AI navigation for the NPC. So in this case we're going to check in place, then we'll check download, make sure our frames per second are 60 and without skin, we'll leave the name as it is. We'll download one more animation clip because this will become a game of freeze tag and it is a ninja, we'll search the sneak walk. So we'll select the sneak walk, we want this in place and because we want the character face from forward, we'll click in mirror, now we'll download, confirm the settings and download. We'll click save, we'll leave the name as is. We should now have all the files we need. Go to the Unity editor, open the mix mode folder, right click and import new asset, navigate to where you downloaded your files, and you hold shift select with your mouse and you can bring them all in at the same time. Click import, next we need to do some organizing and set some options. An imported film box file usually contains a model, materials, textures, rig, and animation. The texture did not automatically appear on the model, to see this drag the player into the scene panel, this player does not have textures, just a blue material and is ready to go. We'll delete temporarily from hierarchy, now we'll drag in the NPC model, and the scene panel, this model is just gray, but on the website it had different textures. To fix this, select the NPC in the mix mode folder, and inspect or click the materials tab, and click extract textures. When the file request opens, open the textures folder, then select folder. You may see a pop-up window that suggests fixing a normal map file to be designated as a Unity normal map. Click fix now, and the textures on the model now look correct. Be sure to click the apply button in the inspector to save all changes. Delete the NPC in hierarchy. Next we'll set options for our imported animations and organize them. Notice the icons for animation clips look different. Select a neutral idle clip, and the inspector we need to set this to loop. Click the animation tab, scroll down a bit, and check on loop time, and loop pose. Don't forget to click apply, you may have to scroll down to see the button. Open the file in the folder by clicking the triangle icon. The greenish triangle icon stands for a Unity Animation Clip. Unfortunately, Mixamo names all its animation clips as Mixamo, which can get confusing when working with many clips. To fix this, select the Mixamo Animation icon, duplicate it, Ctrl-D, and we'll rename this title. Next, drag this clip into the animations folder to keep things organized. Next the clip, and select the sneak walk clip. Open that up, select the Mixamo Animation clip, duplicate, rename this, we'll call this sneak, and we'll drag this into the animations, we'll collapse that, open up the standard walk, once again select the animation clip, duplicate it, and I'm hitting F2 to rename, and I'm going to this walk, and I'll drag the walk clip into animations, and I'll collapse this. Now all our Mixamo files are set and organized. One thing we should check is that all our animation clips are looping, so if you didn't do with the prefab you could go each animation clip and check it, idle is okay, sneak is not, let's fix this now, let's loop time, loop pose, and let's check walk, loop time and loop pose. Save the scene, in the next lesson we're going to learn how to create a third-person player in Unity. Thanks for watching!
Learn on the Go
Take your learning anywhere — the KnowledgeCity mobile app lets you watch lessons on the go.