PDA

View Full Version : Need help: How to Add Objects to a Position_Constraint?


Martin Andersen
02-06-2006, 05:58 PM
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?

la_piaga
02-06-2006, 08:30 PM
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 )

CGTalk Moderation
02-06-2006, 08:30 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.