How to Animate Characters in Unity 3D | Animator Explained

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Awesome. Keen watch later. Always struggled with animator. Subscribed too!

👍︎︎ 3 👤︎︎ u/mechkbfan 📅︎︎ Jun 22 2020 🗫︎ replies

And i will watch it

👍︎︎ 3 👤︎︎ u/skellytongs 📅︎︎ Jun 22 2020 🗫︎ replies

Animation system is ultra expensive yo! Use sparingly plx.

👍︎︎ 3 👤︎︎ u/GagOnMacaque 📅︎︎ Jun 22 2020 🗫︎ replies

Use animations when you absolutely need to show idles or need frequent state changes - otherwise timelines and scripts(with low tick rate). Timelines are crazy powerful if you create custom tracks. Ex. A scripted track to change materials of all LOD objects.

Something I need to test. Sample/frame rates vs performance. I got to compare both animations and timelines.

Edit: one more thing, you can offset animation into the shader, you can even back animations into a texture. Lots of tools for the toolkit.

👍︎︎ 2 👤︎︎ u/GagOnMacaque 📅︎︎ Jun 22 2020 🗫︎ replies

You must have posted this before as I had already subbed and liked the video. Any time frame for the next in the series?

👍︎︎ 1 👤︎︎ u/theregoes2 📅︎︎ Jun 22 2020 🗫︎ replies
Captions
Hi, I’m Nicky. Welcome to my channel about game development. This is a video in a series dedicated to learning Unity’s animation system. In the last video, we learned how to export free characters and animations from Adobe’s Mixamo platform and import them into Unity. Today, we’re going to begin learning the fundamentals of animating these characters in Unity. By the end of today, we’ll have our character animating! We left off the last video having added our downloaded idle, walk, and run fbx files into our mixamo folder. Let’s take a look at the pieces that make up these assets by opening up the idle model. We’ll find the meshes, materials, and rig that make up the model, as well as the animation that we downloaded. If you are wondering why we have two alpha_joints and two alpha_surfaces? These first two here appear to be skinned versions of the meshes which are a combination of their respective meshes, materials, and the mixamo_rig. And Unity combines both of these to make the complete model! Let’s add this model to the scene hierarchy -- placing it here will automatically position it at the world origin: 0 on the X, Y and Z axis. For personal preference, I’m also going to take this joint material and drag it onto our plane object in the scene view, applying the material. You may initially think that by simply adding the character to the scene, you can press play and the character will start performing the animation that you had downloaded with the character. But it isn’t that easy. For the example in this video, we’ll be using Unity’s built-in Animator component and the Animator Controller asset to get our YBot to animate. We’ll start with the Animator component. In the hierarchy, we’ll select the parent YBot gameobject so that it is highlighted in the inspector. Next let’s navigate to Add Component, type in ‘Animator’, and select it. Let’s break down the 5 properties of this component. Our first property here is the “controller” property, which is used to assign an Animator Controller from our assets. Let’s create it by right clicking inside our animations folder of the assets tab, scrolling to create, and finding “Animator Controller. We’ll rename it “YBotController” and then drag this asset into the open slot next to “controller” in the Animator component properties. Great! So what did that do? Currently -- not much. Pressing play again will yield the same results that we had earlier. But I promise we’re close. By double clicking on the YBotController, Unity will open a window titled “Animator” which consists of two panes: the grid pane on the right, and the layers and parameters pane on the left. The grid pane serves as a visual interface for us to create, modify and connect animation states. But you might be wondering “what an animation state even is”. To explain this, let’s think of our three downloaded animations: idle, walk, and run. Each of these will represent their own animation state in our project. For instance, if a player is not moving, then the character will be in an `idle` state, and if the player presses forward, the current animation state should logically be switched to the “walking” state as the model should begin to move. If they stop, then it should switch back to the “idle” state. We’ll take a deeper exploration of controlling animation states in the next video. For now, it’s time to grab the animations from our imported mixamo assets. Opening up the Mixamo folder in the assets tab, we’ll find our three models. Let’s select one of the animations out of an expanded model. Before we create a state from this animation, take a look at the inspector and we’ll notice that the options are greyed out. This is because the animation is a child of the Unity parent model asset. We can actually find the same settings by pressing on the parent model asset and opening the animation tab. Instead, we’re going to separate the animation from the model. To do so, we’re going to duplicate the animation. This is done by selecting the animation and pressing command and d -- or control d on windows. Now, when we select our duplicated asset, we can modify its properties in the inspector window! Let’s duplicate all three, check the `loop` property for each animation, and move them into the animations folder. Looping the animation will continuously repeat the animation if that’s our character’s current animation state. Next we’ll refocus our attention on our YBotController. With our idle animation selected, we can drag it into the grid layer and we’ll immediately see the idle animation state created! Awesome! You’ll notice that the Entry is automatically connect to the Idle animation state. This is because the Idle animation state was automatically set as the default animation state. If we want to switch default states, we right click on a different animation state and select “set as layer default state”. This means that this animator controller will automatically use this animation when we enter play mode. And now if we press play and zoom in on our YBot character, we’ll see him performing the idle animation! To view the walk and run animation, we just need to switch the default state for our animator controller. We’ll end our project today by switching to the running animation and break down the remaining Animator component properties. After the Controller, we have properties titled Avatar, root motion, and two dropdowns: one for update mode and one for culling mode. The open Avatar field is a property that we’re going to take a look at when we retarget our animations to our own characters. So we’ll come back to it in the future. Root motion is when we want a characters movement to be animation-based instead of script-based. A quick shoutout to birdmask studios for this awesome visual breakdown between the two. I’ll link to his video in the description. If you are wondering what the difference is, let’s think of a game like “Inside” where the character movement clearly varies depending on what part of the animation is playing. There is momentum during the middle of the animation, and when the character is switching to the opposite foot, the character movement is at a pause. Then think of a game like Transistor, where the character moves at a steady rate independent from the animation. There’s a script in the background driving the character gameobject’s movement. In the previous video, I explained that we wanted to check the `in-place` checkbox. Had we kept the animation that included the additional movement, root motion would be able to drive the character. But as I said then, that’s not what we’re covering at the moment. Moving on to Update mode -- this is where we can have some fun. Here we have 3 options: Normal, Animate Physics, and Unscaled Time. Normal will alter the character’s animation playback speed based on the current timescale. For example, if we cut the timescale in half, the speed animation will play at half the speed. This makes it easy to create slow motion effects! The animate physics internally shifts the animator logic to the Fixed Update call. In Unity, Fixed Update is used for all things physics. So if our character or animation is intended to interact with rigid body objects, this is likely what we’ll use! And lastly, we have Unscaled Time which means that the animator and animations run independently from the timescale. This is recommended to be used with UI animations so even if your game is running a slow motion mode, the user interface is still clean and snappy. And the fifth property of the Animator component is Culling Mode which has three options: always animate, cull update transforms and cull completely. Culling is a performance saving feature built in to unity which only renders game objects that are in view of the camera. Always Animate does exactly what it sounds like: it always performs the animation and animation calculations even when the model is out of the camera view. When Cull Update Transforms is active, Unity continues to calculate the following frames in the animation, so that when the character comes back into view, it’s as if the animation never stopped. Whereas Cull completely completely stops the animation when the character is removed from the camera view. When returning to the camera view, the animation resumes playing from where it was before being disabled. That was so much covered today, but as always there’s still more to learn. In the next video we are going to take a deeper look at the parameters and layers found in the animator controller and we’ll learn how we can use them to blend animations together! And as the series continues, we’ll learn to retarget our animations to our own characters and how to control them. As always, if you learned something new today, please consider pressing that like button and subscribing to the channel. It really helps me and the channel to grow. If you have any questions, feel free to leave a comment below, and I’ll be sure to get to it as soon as I can. That’s it for today — Thanks again and I’ll see you in the next video.
Info
Channel: iHeartGameDev
Views: 289,284
Rating: undefined out of 5
Keywords: unity animation, unity animation tutorial, unity tutorial, unity 3d animation tutorial, how to animate in unity, animate in unity, tutorial, animate in unity 3d, unity for beginners, unity fundamentals, unity beginner tutorial, loop animation in unity, how to animate in unity 3d, unity animation transition, unity animation basics, unity, Unity Animator, How to Animate Characters in Unity 3D, 2020, animate characters unity, animator explained, unity3d animation, animate unity
Id: vApG8aYD5aI
Channel Id: undefined
Length: 7min 51sec (471 seconds)
Published: Sun May 31 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.