Topic: version 4 MAXScript New Features/Constraints
Position_Constraint - superclass: PositionController
Position_Constraint Interfaces
A position constraint causes an object to follow the position of an object or the averaged position of several objects.
In order to activate, a position constraint requires an object and a target object. Once assigned the object becomes constrained to the target objects position. Animating the target's position causes the constrained object to follow
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 a ball being picked up from a table.
Multiple targets can be used to influence a constrained object. When using multiple targets, each target's weight value defines how much it influences the constrained object. For example if a sphere is Position constrained between 2 targets and each target's weight value is 100. Then the sphere will maintain an equal distance between both targets even when they are in motion. If one of the weight values is 0 and the other is 50, then the Sphere is only influenced by the target with the higher value.
Example:
posCtrl = Position_Constraint()
posConstraintInterface = posCtrl.constraints
appendTarget <node>
Adds a node to the node list with a default weight of 50
getNode <index>
Returns the node specified by the index. Index is a 1 based array
getWeight <index> <time>
Returns the weight at the time for the node specified by the index.
setWeight <weight> <index> <time>
Sets the weight for the node specified by the index at the given time.
Use:
posConstraintInterface.appendNode $box01
posConstraintInterface.appendWeightedNode $box02 200
node1 = posConstraintInterface.getNode 1
posConstraintInterface.setNode $box03 2
weight = posConstraintInterface.getWeight 1 50
posConstraintInterface.setWeight 250 1 0
See also
Orientation Constraint Controller