Portfolio 4 - Tutorial 2


Animation in Unity

For this tutorial session, I had to import my model into Unity and figure out how to set up its animations. This was relatively easy to begin with, since I simply linked the idle animation to the entry condition on the object's animator component and controlled the beckon animation with a simple script that toggled a parameter in the animator component. While the character could move through a basic movement script, this movement had to be linked up with the walking animation, and we were tasked with trying to dynamically match the speed of the character to the speed of the animation. At first, I went about this the wrong way by trying to use the biggest value between the velocities on the x (horizontal) and z (depth) axis and it somehow ended up looking like this:

Eventually, I was able to produce what you see in the first image by getting the magnitude of the velocity (determined by subtracting the position in the last frame by the position in the current frame over time), which Unity conveniently provides access to. I did have to tweak how the magnitude mapped to the animation speed, and the first thing I tried was performing a Log transformation on it to normalize it back down from overly fast speeds (I thought to do that because I'd just had another class where I did the same thing with a different type of data), but I felt this was still a little fast, so then I divided it by two, which seemed to fit.

Leave a comment

Log in with itch.io to leave a comment.