"Fishing for Programmers"

An Animation Final Project for CPE 474

Explanation

Binding to a Skinned Model

The program uses a coordination of skinned animation and a simple mass spring in order to simulate an animated character (Cheb) holding a fishing pole suspending the wild programmer's favorite bait: caffeine. This system makes heavy use of a technique to access properties of a skinned mesh, namely the position and normal vector of any given vertex in the skinned model at any given time. Using this system, I can define a location that will always be in front of Cheb by knowing the position and normal of a vertex on Cheb's stomach. This method actually works better than simply attempting to bind a relative position in the frame of one of Cheb's bones, as quirks of the Cheb character mean he has no good "root" bone to bind to. The result of this method is a much smoother bind than using a single bone, as it relies on the same kind of weighted interpolation of bone frames employed by the model's own skinned vertices.

Inversely Computing the Fishing Pole Frame

Once a location is found in front of Cheb, it gets put to use in order to inversely determine the frame of the fishing pole. The planar XZ location in front of Cheb is saved and the Y location discarded, defining a Y-axis-aligned line along which the pole tip may rest. On the other side of the fishing pole, the handle is bound to a point on Cheb's left hand. Using the defined length of the fishing pole, there is a unique vector of that length in the positive Y direction that has endpoints both on Cheb's hand and on the given line (assuming this pole length is greater than the XZ displacement such that the fishing pole wouldn't be lying perfectly flat - it would form a triangle). The pole itself is aligned along this vector, and the rest of the pole's frame is defined using a cross product with the previously mentioned XZ displacement vector in order to ensure the reel points in the correct direction. Defining the frame in this way (using the relative line and length from Cheb's hand) allows the pole to bob in a natural way as Cheb swings his hand, while ensuring it always remains at a reasonable angle in front of him. Cheb's hand can optionally be bound to this save frame by pressing the key 'b', although this results in horrifying contortions and is therefore not shown.

Animating the Suspended Coffee Mug

The fishing line exists as a mass spring connecting the computed fishing pole tip's location to the mug's handle. The spring applies a tension force to the mug keeping it at a target rest length, while gravity ensures a natural rest state of the mug somewhere below the pole's tip. The system as a whole is dampened marginally in order to prevent unstable springs and a general jerky (not smooth) animation. Constants such as the spring stiffness, the dampening, and the gravitational acceleration are carefully tuned for smoothness and visual appeal, not physical accuracy. The spring's length is controllable via the Up and Down arrow keys, allowing Cheb to both reel in and let out the bait.

The mug itself also has a well-defined frame, with the mug's handle always pointing along the spring's tension vector in order to simulate a fixed attachment point of the spring on the mug. The mug also makes use of the normal vector of Cheb's stomach (as previously described) in order to define its facing direction. The mug interpolates its current rotation and the rotation if it were aligned to that normal vector, allowing the mug to slowly approach this position. This method allows the mug to rotate along with its motion in a pleasing way, instead of remaining aligned to an arbitrary axis or looking unnaturally fixed to always face Cheb without any interpolating.

Sample Animations

Walking

Running

Cross-Walking

Video Sample

Credits

"FREE Coffee Mug" by plasticarm
"Free Item: Fishing Pole" by JHoagland