Character movement and animation


Today I imported an animated character into unity and made them move around and activate a door trigger.

The first step was to import the model, which was easy since it was an .FBX which also meant it included the animation data I needed.

I gave the model some components and tagged it as a player

Rigidbody so that the model can collide and interact with other objects

Character Controller, which was required by the MyThirdPersonController script in order for our character to move around.

a box collider converted to a trigger so that he can activate the 'door' you can see in the gif at the top of the page.

A wave script which triggers when the player presses spacebar.

  Very Cute :)

The Third Person Controller script controls how the character moves.

Finally, a script to control how the character walks when the player uses the WASD keys.

I wrote this script from scratch and it's pretty simple:

First we have to set up our Animator like this.


Instantiate an animator object and a ThirdPersonController object (or whatever script you use to control your character).

set the walk animation to "false" as it's default state when the game starts.

in the Update function, add an if statement that checks if the player is moving the character using the Vertical or Horizontal control schemes. If either of these are true, then the walking animation will be set to true, otherwise it will be reverted back to false to stop the animation.

And that's about it, pretty simple once you understand what you need to do.

Leave a comment

Log in with itch.io to leave a comment.