A set of predetermined animations were loaded and extracted from Mixamo using code from Assignment 2. Initially, animations were loaded using absolute transforms, however, this was difficult to blend as the character would move in space in addition to joint rotations making interpolating frames look nonsensical. This was remedied using Relative Transformations. Instructions for doing this were in the README for fbx-extract that we were provided. Essentially, the absolute/world transform for each joint was calculated using the absolute transform of its parent, its static transform, and its relative rotation.
The program functions using a frame queue that user actions can be added to. If no animation is in the queue at the end of a walk cycle, another walk animation plays. If an animation is queued while walking is in progress, the outgoing walk frames are blended with the incoming action frames. The amount of frames blended is a minimum of the frames in the queue and 15. This form of action interruption makes it so that the resultant blended animation reflects the time at which an input was entered. After each action input, a walking animation is queued and merged with the action animation in order to smoothly return to walking.
Interpolating between frames was difficult when using absolute transforms. Each transformation matrix had translations and rotations applied making them unusable for interpolation. This was made easier using relative rotations because quaternions can be linearly interpolated as was done in Assignment 1. However, the skinning code taken from Assignment 2 required absolute transformations. The final implementation involved taking two frames and an alpha value and interpolating all the quaternions for each joint. Alpha was selected such that the outgoing animation is weighted heavily at the beginning of the blend and lightly towards the end leading to smooth transformations. After the quaternions are interpolated, absolute transformations are calculated for each bone by traversing the hierarchy tree and using static transforms as was done when parsing the animations.
The user can toggle spheres which initiate a sort of game where green spheres represent health points, red spheres represent hurt boxes, blue spheres represent hit boxes, and black spheres represent enemies. If an enemy hits a blue sphere it gets destroyed. If an enemy hits a red sphere it gets destroyed, and the player loses a hit point. Spheres spawn randomly in front of the character and consistently fly towards the point where the character's head was at the time of spawning.