Caffeine Abuse - The Blog

Surface constraint and transformation

While constraining an object to a surface as such is a straightforward task and won’t require more than a few mouse clicks, it may still leave you with a sensation of not being quite satisfied. Once you add the constraint you loose the option to freely move the object with the standard translate tool and are left with two (somewhat less intuitive) sliders within a PPG. By adding an extra dummy object to the mix, you’ll effectively manage to get the most out of both approaches.

The project files used in this tutorial can be found at:http://dl.dropbox.com/u/3834689/CaffeineAbuse/Surface_cns.zip

Surface_CNS_img01

Add Surface Constraint
Start by position the Null object in the lower right corner of the Surface (X:-4, Y:0 Z:4). Select the Box and click the Constrain button in the Main Command Panel and choose Surface (Param) from the menu. Pick the Surface when prompted. In the Surface Cns PPG click the Lock icon to pin it to the screen. Activate both the Tangency and the Normal by checking the checkbox under there respective tab. Return to the Surface tab. Make sure both the U and V Location are set to 0 [zero]. Right click on the U Location’s animation icon (the green divot) and choose Link with… from the menu to open the Parameter Connection Editor.

Surface_CNS_img02

 

Link the parameters
In a viewport, select the Null object and (if neeed) then click the Refresh button for the Driving Source to update the explorer. The Driving Source is the object used to control or drive the parameter whereas the Driven target is the parameter that will end up being affected. Click the Driven Target button in the menu and change the Filter to All Nodes to display the proper parameters. In the Target explorer, expand the kine.Constraints node and select the surfcns.posu parameter. Select the posx parameter in the Driving Source explorer. Click the Link button to create the connection and the Set Relative Value button.

Surface_CNS_img03

Change the interpolation
Move the Null object to the Surface’s lower right corner and change the U Location value to 1 in the Surface Cns PPG. Click the Set Relative Values button in Parameter Connection Editor. Continue by selecting the surfcns.posv and the Nulls posy parameter. Click Link button followed by the Set Relative Value. Position the Null in the upper right corner of the Surface. Change the V Location in the Surface Cns PPG to 1 and set a new Relative Value. Select the Box and click 0 [zero] to open an Animation Editor. Select the Fcurves for the surfcns.posu and surfcns.posv and from the Curves menu choose Linear Interpolation. Move the Null to translate the Box over the surface.

4 Comments

  1. April 10, 2012

    Before ICE made our lives (mostly) easier, a really good, stable/proven “cheat” alternative to your approach was to use the classic Shrink Wrap deformer to “project” a poly square from which to derive transforms.

    The “long” version:
    1. Make a 1×1 grid object roughly of the desired sample size, then place it relatively close to the target surface. (If you scaled the grid, do Transform-Freeze Scaling before proceeding.)
    2. Swith to Animation Construction Mode for this step and with the grid selected, do Deform->Shrink Wrap then pick your surface. Set the wrap mode to “Closest Smoothed Surface”.
    3. Make a cluster of all (4) points of our square.
    4. Make a null and do Constrain->Object-To-Cluster, then click on the cluster from the previous step. (Be sure to check “Active” in both the Tangency and Normal tabs of the constraint.)
    5. That’s all. Now whenever you translate the grid object, your null will reliably slide along the surface.

    This trick is easy, super stable, requires no ICE/scripting/expressions/math knowledge and works with NURBS, polymeshes and even curves.

    It’s how I rigged the projected eyeballs of the Excel Donut character featured in my 2010 rigging reel at http://darkvertex.com

    Love this blog of yours, by the way. Been a silent lurker for a long time. 😉

  2. July 25, 2012

    Your content is shows potential, m gona add this to my bookmarks.

    vector free

  3. June 14, 2014

    I have been leeching your knowledge and I dont recall ever posting in here. Im sorry for that, and at the same time, thank you for sharing tutorials with us all this time. Also, thank you for your tutorials in 3d World magazine.

  4. June 18, 2014

    Hi Luis

    Please feel free to post as much as you like 🙂

    cheers
    ola