page 1 - yoyo on a string - MAYA TUTORAL 3 
This tutorial was written by Chas Jarret and invloves animating a yoyo with the attached string wrapping around the fingers of a deforming hand. It contains some interesting techniques for solving the problem of realistic string movement between the hand and yoyo and also, an ingenious solution for getting the string to seemingly twist and wrap around the cg fingers.
An animation is available for download at the end - the render here does not represent the proper look of the project.

"This tutorial is based on a recent job I did for Credit Suisse featuring two shots of an arm and hand playing with a yoyo. The overall look of the project was set out explicityly by the director and was based upon slick colourised X-ray's but here we will concentrate on the animation side of things.

Initially we decided to shoot the arm, hand and yoyo live-action on green-screen and then rotoscope a CG skeleton to the arm.  The live-action arm, yoyo and string would be treated in Inferno to give them an X-Ray look with the CG skeleton composited in to complete the illusion.  Unfortunately complications arose on the shoot which made this approach impractical, so eventually I produced the entire commercial in 3D using Maya 1.5 and Renderman. This wouldn't normally present any problems except that this script called for a shot where the yoyo gets stuck and in response the hand wraps the string around it's fingers.
Detailed here is the method I chose to achieve both the yoyo's movement and the deforming string.

Having setup and animated the arm  (NURBS arm bound to joints and skeleton bones parented to joints) I then moved on to the yoyo. The yoyo was meant to be held by the hand at the start and end of the 160 frame shot, with two "downs and ups" inbetween.
To make sure the yoyo stayed firmly held by the hand at these times, I decided to use Maya's "point constraint" feature which will move the constrained object to the constraining objects position.

I first created a locator from the "primitives" menu and named it "handLocation".  I positioned this in the palm of the hand and parented it under one joint in the palm.  I then created another locator and named it "yoyoLocation".  I then point constrained the yoyo's top node to both of the locators by first selecting a locator, then the yoyo, then choosing "point constraint" from the "constraints" menu.

By then selecting the yoyo's top node, both constraint weights are displayed in the channel box.  By default they are both set to 1.0 meaning that each locator has equal influence over the yoyo's position.  The result is that the yoyo moves to a position directly inbetween both locators (see fig.1).  To simplify animating these constraint weights I adjusted both their values to 0.5 which yields exactly the same results (since the weights are equal), but moves the weight range to zero to one.

By now reducing the "yoyoLocation" weight to 0, and increasing the "handLocation" weight to 1, the yoyo moves to the palm of the hand and follows its movement.  I keyed these weights at these values until the moment where the hand is supposed to release the yoyo.  At this frame I moved the "yoyoLocation" locator to the yoyo's position, keyed its translation channels and swapped the constraint weights so that "yoyoLocation" had total influence over the yoyo.  From here I could animate "yoyoLocation" to create the yoyo's movement.  By then returning the constraint weights to their opposite values at the moment the hand grabs the yoyo at the end of the animation, it will again stay firmly fixed to the palm.

This method of using multiple constraints led me to a solution for animating the yoyo's string and creating the illusion that it was winding up or out of the yoyo's hub as it went up and down, and then to a solution for wrapping the string around the hands fingers when the animation responds to the yoyo getting stuck.

The string was a NURBS cylinder with plenty of spans to allow it to deform at any point along its length.  To control its deformation I decided to use a wire deformer placed through its length. Wire deformers are created from NURBS curves to which geometry is bound.  By then moving the curves CV's the geometry is deformed.

To produce the correct deformation I created a curve with 6 CVs right through the centre of the cylinder.   Each CV was then converted to a cluster by selecting them one at a time and choosing "cluster" from the "deformation"menu.  This made each CV fully keyable and more importantly, constrainable.  For the puposes of this tutorial let's number the clusters 1-6 from the top down (see fig. 2).  Then by choosing "create wire" from the "deformation" menu and following the help-line prompts, I selected the curve and then the cylinder/string and pressed enter to bind the string to the wire.

The next step was to connect one end of the wire to the hand's index finger (where the loop of a yoyo's string normally goes), and the other end to the yoyo. To do this locators were placed at the relative places, one called "fingerConstraint" and the other called "yoyoConstraint", and these were parented under their respective objects/nodes.  Cluster 1 was point constrained to "fingerConstraint" and cluster 6 was point constrained to "yoyoConstraint" (see fig.3).  Each end of the string was now following the object it should.

The trick now was to get the rest of the string (clusters 2-5) to stay in between the finger and the yoyo as each end of the string moved around.  To do this each of the remaining clusters were point constrained to both "fingerConstraint" and "yoyoConstraint" with constraint values relative to their desired distance from each locator, as shown in fig.4.

The basic yoyo animation was now complete with the string appearing to unravel as the yoyo was thrown.

Next I had to make the string wrap over the thumb and index finger. I again created locators, one placed at the thumb at the point where the string was to wrap over it, and one placed at the index finger just inside the last joint where the finger would grab the string.  These locators were named "thumbConstraint" and "indexConstraint" and were parented under their nearest joints.

Clusters 2 and 3 were point constrained to "indexConstraint", while clusters 4 and 5 were point constrained to "thumbConstraint".  The hand and yoyo were already animated making the required movements, so all I needed to do was make the string stick to right bit of each finger by animating the constraint weights on and off as the fingers touched the string.  The reason for having two clusters at each constraint locator was simply to accomodate the NURBS curve's (wire deformer's) degree of curvature which would have had a far too wide arc had I used only one CV at each point, as you can see from fig.5.

And there you have it.  The only thing missing now is some wobble in the string.  I have a method for this figured out, but my clients on this job said they liked the string to be taught and without wobble, so I won't go there now.


Chas Jarrett
Sept '99.

If you have a tutorial you would like the Jackal to host, please mail me.
The Jackals Forge Copyright © 1998 Richard Morris