Notifications
Clear all

[Closed] apply path constraint using mapped operation?

hi there…i wanna to add Path_constraint COntoller and the path itself
like this
Box01 path constraint to Line01
Box02 path constraint to Line02
Box03 path constraint to Line03
and so on, it’s a mapped operation.
so i do this…
1.Create array of Box in good order–> called BoxArray (i’ve done this)
2.Create array of Line in good order–> called LineArray (i’ve done this)
3.then i create for loop below:

pathCon=path_constraint()
for i=1 to 20 do
(
	BoxArray[i].position.controller[3].controller=pathCon
	BoxArray[i].position.controller.setActive 3
	BoxArray[i].position.controller.path_constraint.controller.path = LineArray [i]
)

all the box has PathContsraint as active controller but the target path is not correct…
all the box has target path :Line20

i don’t know whats wrong because i think this simple algorithm can do this correctly

2 Replies

i found the problem…and solved it.
it’s because i make definition
pathCon=Path_constraint()
thanks…

Yes, you are making an instance of the controller by doing that. This means that everything it is applied to gets the same controller, therefore any changes are applied to all. Another option would be to do something like this:

BoxArray[i].position.controller[3].controller=(copy pathCon)

This should create a unique copy when applying the path constraint.

-Eric