Constraints: Understanding Direction and UpVector Constraints


The purpose of this article is to explain the Direction and Up Vector constraints in XSI.

The Direction constraint lets you constrain an axis of an object to another object without changing the location of the constrained object. The aligned axis (the X axis by default) of the constrained object always remains facing the center of the constraining object, which affects the orientation of the constrained object.

  • If you translate the constraining object, the constrained object rotates so that its specified axis always faces the constraining object, like a sunflower facing the sun.
  • If you translate the constrained object, its specified axis continues to face the constraining object from its new location like a geosynchronous satellite; that is, it is always pointing toward the same location on earth as it follows the earth’s orbit.

The Up Vector constraint makes the Y axis of a constrained object point to a constraining (control) object or a specific point. For example, by constraining a camera’s up vector to a control object, you can control the camera’s up direction to prevent it from flipping when it reaches a vertical axis with the interest.

An Up Vector constraint isn’t a true constraint per se (that is, it’s not an operator), but is actually a property of several different types of constraints: Direction, Position, Surface, 2-Point, 3-Point, or Curve (Path). The up-vector constraint cannot exist on its own: it only works only if one of these constraints is already applied to an object.


For an illustration of what is explained here, you might want to first run the following script:

       CreatePrim "Cone", "MeshSurface"
       Translate , -7.184, 4.297, -0.430, siRelative, siView, siObj, siXYZ
       Translate , -0.039, -0.352, 0.035, siRelative, siView, siObj, siXYZ
       CreatePrim "Cylinder", "MeshSurface"
       Translate , 5.475, -2.665, 0.266, siRelative, siView, siObj, siXYZ
       ApplyCns "Direction", "cylinder", "cone"
       SetValue "Camera.camvis.attrselconstraintlink", True
       SetValue "Camera.camvis.attrselconstraintinfo", True
       SetValue "Camera.camvis.compobjselcenter", True 

This script will direction-constrain a cylinder to a cone and activate Show > Relations and Show > Centre (see illustration) so that you can see the relationship:


Let’s inspect the various parameters available for the Direction constraint:

With the cylinder selected, open an explorer and expand the cylinder’s Kinematics > Constraints nodes and click on the Direction Cns icon to open its property page.

Direction > Align Axis

The Align Axis parameters specify the axis to point along—X is the default—with respect to the local coordinates of the constrained object. If two or more axes are specified, the object points along the resulting vector.

In the example case above, the default setting makes the cylinder's X axis point to the cone's centre. If you change the Align Axis to (XYZ 1, 1, 0) you will notice that the cylinder rotates so that its local (1, 1, 0) vector is now pointing to the cone's centre. Once again, if you change the Align Axis to (XYZ 0, 1, 0), you will see it is the cylinder's Y axis that is now pointing to the cone's centre.

Direction > Target Offset

The Target Offset sliders define the offset on any axis (XYZ) from the centre of the constraining object, expressed in the local coordinates of the constraining object. This is a rotational offset in degrees from the constraining (target) object. If you change the target offset to non-zero values, the cylinder points to the offset point away from the cone's centre. Try changing the X offset to 4 to see this effect. Now try higher values on all three axes for a more drastic tilt!

UpVector > Affected Axis and Point At

Click the Up Vector tab in the Direction constraint property editor to find these parameters. The Up Vector’s Affected Axis is similar to Align Axis in that it represents a vector with respect to the local coordinates of the constrained object itself.

The Point At parameters represent a vector in world coordinates, which specifies where you would like the Affected Axis to point.

Try the following:

  1. Activate the Up Vector for this example (by default the Affected Axis is the Y axis).
  2. Change the Point At values to (0, 0, 8): you will notice that the Affected Axis does not align itselt to the Point At. This is because the UpVector axis is in conflict with the defined Align Axis for the Direction constraint; therefore a solution for the UpVector cannot be found.
  3. Now change the Affected Axis to (0, 0, 5). Observe how the cylinder rotates a little, to satisfy the Up Vector, while still keeping the direction constraint intact.

This page was last modified 20:02, 6 Dec 2010.
This page has been accessed 188682 times.

© Copyright 2009 Autodesk Inc. All Rights Reserved. Privacy Policy | Legal Notices and Trademarks | Report Piracy