Parameters are variables that are defined within the animator that scripts can access and assign values to, this is how a script can interact with the Animator. The way we add control is through Parameters. It idles and runs without us doing anything. ![]() We have our model animating but it lacks control. Ethan idles for a bit then starts walking. To do that, right click on the Default State and select “Make transition”. Then click on the “HumanoidWalk” state. We want our character to be able to run and walk around the scene. That is pretty neat, but it makes for a really boring game. This means that as soon as the game starts it will go to the Default State. See how the Default State has an orange arrow coming from the box that says Entry. To do this right click on “HumanoidIdle” and select “Set as Layer Default State”. We want the “HumanoidIdle” to be the Default State. The orange one is the first one you selected in your Project tab. Also, notice how one of the boxes is orange. Now there are three new boxes in our tab, those are the animations known as State Machines. Look for “HumanoidIdle,” “HumanoidWalk,” and “HumanoidRun.”ĭrag these three into your Animator tab. In your Project tab set the filter for animations. Here is where we add in the animations that will effect our model. With the Ethan model selected, navigate to the “Animator” tab. Culling mode allows you to determine if you want to keep animating even off screen. Such as with physics, with a fixed speed, or just normal. With “Update Mode” you can determine how you want your animations to play. However, as we will see soon, we want to enable Root Motion in this case. Since the script is moving the character not the animation then I would want Root Motion set to false. I have an animation attached of the character running in place. For example, say I have a script that makes my character move forward. The “Apply Root Motion” boolean determines if Unity will use the movement in the animation or a script. Let’s look at some of the settings in the Animator component. Press done and go back to the Ethan model. Click on the circle next to the Avatar field and find the “EthanAvatar”. Lets have a look at the Avatar.Īs you can see, the Avatar is just a way for Unity to find and configure the bones in the model. ![]() For humanoid characters, such as ours, it requires something called an “Avatar”. The Animator Controller allows you to assign multiple animations to a model. Drag our new Animator Controller onto the Ethan model. Right click and go to Create -> “Animator Controller”. Navigate in your project files to Standard Assets -> Characters -> Models and drag in the “Ethan” model. Once you have got a feel for how the character moves, ThirdPersonController is no longer needed and you can delete it. We are going to build, from scratch, a character that moves similar to this. This is optional but, go ahead and drag in the “ThirdPersonController” into the scene. Next, make some cubes and ramps for our character to run and walk on Now make a plane for the character to stand on. Uncheck the first person character since we won’t be working with that. Go to Assets -> Import Package -> and select the “Characters” package. ![]() Create a folder called “Scenes” and save the current scene in that folder. AVAILABLE FOR A LIMITED TIME ONLY Setting up the project
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |