Notifications
Clear all

[Closed] Need help: How to Add Objects to a Position_Constraint?

Hi…

How can I add an array of objects to a Position Controller ?

lets say I have a object : $box01
and I want to add an array of objects to the box’s position controller… how can I do that with Maxscript?

1 Reply

for i =1 to array.count do ( $box01.position.controller.appendTarget array[i] 1 )

  :)

The final 1 is the weight, if you want to assign a particular weight per target you have to manually add targets 

$box01.position.controller.appendTarget array[1] weight1
$box01.position.controller.appendTarget array[2] weight2
 .
.
or to put the weights in ad array:

for i =1 to targetsArray.count do ( $box01.position.controller.appendTarget targetsArray[i] weightsArray[i] )

edit
Ooops… I guessed you mean position_constraint, in order to make max calculate the box position by interpolation of targets positions.

In case you want to drive different objects moving the box, you have to assign a constraint position controller to the objects

for i =1 to objsArray.count do (objsArray[i].position.controller = position_constraint() )

and assign them the box as target

for i =1 to objsArray.count do ( objsArray[i].position.controller.appendTarget $Box01 1 )