expressions/miultipleobjects
hi,
i just created these two expression, which basically calculated the distance between a sphere and a series of panels. then, when the distances is less than 3, the panels should rotate. the problem i am having right now is that each expression creates a new expression per each panel, so i am finishing with hundreds of expressions. is there any way to do it with out creating more expressions? i have tried creating strings, yet i am having problems assigning float values. i would appreciate any help.
//calculates distance
for($n in `ls -sl`){
expression -s ($n + ".distance = clamp (0,
(nurbsSphere1.scaleX),
sqrt((pow((translateX- nurbsSphere1.translateX),2))+(pow((translateY- nurbsSphere1.translateY),2))+(pow((translateZ- nurbsSphere1.translateZ),2))) );") -o $n -ae 1 -uc all ;
}
//panel rotation
string $sel[] = `ls -sl`;
for($object in $sel){
expression -s ($object + ".rotateX= (abs(distance-3))*20;;") -o $object -ae 1 -uc all;
}