Position Constraint Workflow
 
 
 

The user can employ the Position Constraint to make a source object move to and be coincident with another object, called the target object. Position Constraint,which constrains the position of an object to a target, is similar to instancing the position controller of one object and pasting it on another. Rotation and scaling is completely free. Once engaged, the source object becomes constrained to the target object's position. Animating the target object's position causes the source (constrained) object to follow.

In the figure below the red sphere is the source object and it is position constrained to the yellow sphere, which is the target object. The constraint is under the special option called 'Keep Initial Offset', such that the source object doesn't jump to the target object when assigned but preserves its current position. Essentially the source object appears to be connected by a rigid rod to the target object. If the target object's position is animated through different frames, the source object faithfully follows the target on an identical trajectory - the trajectories are shown below with red lines.

The Position Constraint can also move an object to the position of the weighted-average of several different targets. Each target has a weight value defining its influence. A value of 0 is equal to "off". Any value greater than 0 will cause the target to influence the constrained object. Weight values may be animated to create effects such as a ball being picked up from a table. Note that the weights are pure numbers (which are normalized "under the hood" before being applied) and not percentages.

Procedure to engage the position constraint:

  1. Select the object you want to constrain
  2. Choose Animation menu > Constraints > Position Constraint.
  3. Select the target object.

The user interface of the Position Constraint in 3ds max is shown below. The various options of the constraint can be accessed through the motion panel - see the UI snapshot below. A familiarity with the UI will be necessary when we discuss how this is handled by the code.

User Interface Description

The UI works as follows. The user selects an object and assigns Position Constraint. Next, in the Position Constraint UI menu the following functions can be performed:

  1. Add Position Target: The user clicks on this button and selects one or multiple targets on the scene. The Position Constraint mode is cancelled by a right mouse click. The selected targets appear in the listbox with their default weight of 50.
  2. Delete Position Target: The user can select (highlight) a target in the listbox and remove it from the target list by clicking on the "Delete Position Target" button.
  3. The weight spinner control: The user can type-in the required numerical weight for the target selected in the listbox. The weight can be modified with the adjacent spinner. The listbox shows the weights as integers but the weight edit box shows the selected weight as a decimal point float.
  4. "Keep Initial Offset" option. This option is off by default. In the default mode once the constraint is applied to a single source object, the object jumps to the to the weighted-average position of the targets and their pivot points coincide. When this option is selected the source object maintains the offset between its initial position and the initial position of the target.