Tutorial 2
In Tutorial 2, I imported the character I created in Blender for Self-Study 2, along with its animations, into Unity. While the import worked well, I ran into an issue where the orientation of the character wasn't centered. Because of this, when I added a simple movement script to the character, it would move sideways (as shown in the first gif below).
To remedy this, I created an empty GameObject and set it as the parent of the character. After some tinkering with the rotation of both the parent and the character, I was able to get the player to move in the correct direction (as shown in the finished gif).
As shown in the gif, I also added a functioning trigger system, with features such as:
- A block disappearing when the player touches a trigger (this could represent a door or similar object).
- Triggers activating animations:
- When the player is not moving, the idle animation (just a static pose) plays.
- Pressing spacebar plays the wave animation using a Trigger parameter.
- The walk animation is activated using a Float parameter that checks the player's speed (if speed > 0.1, the walk animation plays).
While writing the script to activate the walk animation, I ran into a problem where the animation wouldn't play, no matter what I tried. After experimenting with different script variations and parameters, I realized that the issue was because my Third Person Controller script (containing movement and animation code) was actually attached to the empty parent object, not the character model itself.
To solve this, I modified the script to use GetComponentInChildren
to access the character's Animator and Rigidbody components properly. Once I did that, the animations (walk, idle, wave) all triggered correctly based on player input and speed.
Get KIT207 Portfolio
KIT207 Portfolio
Things done after being told to do them from KIT207
Status | Released |
Author | FabianLampasona |
More posts
- Self Study 591 days ago
- Self Study 4 pt 2 Game Ideas98 days ago
- Self Study 4 pt.198 days ago
- Tutorial 399 days ago
- Self study 3Mar 17, 2025
- Self Study 2Mar 10, 2025
- Tutorial 1 devlogMar 10, 2025
- Self Study 1Feb 26, 2025
Leave a comment
Log in with itch.io to leave a comment.