Position_Constraint - superclass: PositionController

Position_Constraint - superclass: PositionController; super-superclass:MAXWrapper - 1:0 - classID: #(8217, 0) 

Value > MAXWrapper > PositionController > Position_Constraint

 

   

Animation Controllers - Quick Navigation

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 might be animated to create effects such as, 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 two 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.

   

Constructor

Position_Constraint...   

Properties

<Position_Constraint>.relative Boolean default: false -- boolean 

Position_Constraint interfaces:

Interface:constraints 

Methods

<integer>getNumTargets () 

Returns the number of target nodes in the target list.

   

<node>getNode <index>targetNumber 

Returns the indexed target node.

   

<float>getWeight <index>targetNumber 

Returns the weight of the indexed target if the targetNumber is relevant, 0.0 otherwise.

   

<boolean>setWeight <index>targetNumber <float>weight 

Sets the weight of the indexed node specified by targetNumber . Returns True on success, False otherwise.

   

<boolean>appendTarget <node>target<float>weight 

Appends the specified node to the list and sets its weight to the specified value. Returns True on success, False otherwise.

   

<boolean>deleteTarget <index>targetNumber 

Deletes the indexed target. Returns True on success, False otherwise.

   

EXAMPLE

s = sphere pos:[20,20,20]
b = box pos:[-20,-20,-20]
posCtrl =Position_Constraint()
s.pos.controller = posCtrl
posConstraintInterface = posCtrl.constraints
posConstraintInterface.appendTarget $box001 20.0
node1 = posConstraintInterface.getNode 1
weight = posConstraintInterface.getWeight 1
posConstraintInterface.setWeight 1 0.0

See Also