Posted March 14, 2025 by FabianLampasona
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:
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.