Advanced Animation Programming
(August - December 2020)
After taking Intermediate Graphics & Animation Programming, the logical next step was Advanced Animation Programming. Unlike the previous class, we were given the option to work in animal3D (C), Unity (C#), Unreal (C++), or any other framework that would allow us to complete our assignments. Cameron Schneider and I decided to continue to use animal3D, as we were already familiar with its quirks.
The class covered many areas of animation programming including pose-to-pose animation, forward and inverse kinematics (FK and IK), blend trees, and having animations respond to user input. There wasn't much range for us to customize our work until the final project, where we were tasked with creating something that incorporated each of the main topics of the course. Cameron and I decided to implement character control for a wolf walking up a slope. We started by obtaining a skeleton and animation clips for a wolf, the latter of which we converted into an HTR file and loaded into animal3D. From there, Cameron was responsible for implementing raycasting so we could detect whether the wolf was on a slope, and I revamped our blend tree so it would be easier to construct and modify. I also set up the code that would actually run the raycasts, which we used to determine the positions of the IK constraints.
The large orange orbs are positioned one unit below the sources of the raycasts, and the cyan dots are the positions that the raycasts are hitting. These raycasts are bidirectional which allows us to determine whether a paw is above or below the floor. If the raycast source is below the floor, we move the IK constraint for that leg upwards until it's touching the floor, at which point we apply the IK solver.
The wolf bobs up and down as it goes up the ramp because its height is currently determined by a comparison between the distance from the shoulder to the paw in the wolf's idle pose (a stored constant) and the current distance between the shoulder and the floor. If the shoulder-to-floor distance is greater than the expected length, the wolf moves down to compensate, and if the shoulder-to-floor distance is less than 85% of the constant, the opposite occurs. This implementation was necessary because animal3D, being a graphics framework, lacks a built-in collision resolution system.