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:
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.
UTAS KIT207 Portfolio
My university portfolio for 2022
Status | In development |
Category | Other |
Author | Sevensz |
More posts
- Lighting and MaterialsAug 19, 2022
- Self-Study 4Aug 09, 2022
- Game brainstormingAug 09, 2022
- Self-Study 3 MoonscapeAug 07, 2022
- Navmesh and AIAug 03, 2022
- First Animation PracticeJul 24, 2022
- Mercedes GLC RenderJul 23, 2022
- Moonah Giant Bowling Pin ModelJul 19, 2022
Leave a comment
Log in with itch.io to leave a comment.