The question is how to rotate array of objects by Y axis according to theirs wirecolor, where they have random grayscale color and rotation must be in interval between 0 and 90 degrees. And there is my script for:
for i in selection do
( -- assign random grayscale color
i.wirecolor.r = random 0 255
i.wirecolor.g = i.wirecolor.b = i.wirecolor.r
-- test result to Listener (optional)
print i.wirecolor
-- handle variables to achieve rotation b/n 0 and 90 deg.
perc = (i.wirecolor.r as float) / 255
ang = 90 * perc
-- finaly rotate them
doRotate = rotate i ang y_axis
) -- thats all :)
-- and test scene result here:

No comments:
Post a Comment
Thanks for your comment