[Closed] Maxscript basic question
hi everybody
i’m just learning maxscript from the very basics. i found a tutorial in which you can move and rotate a collection of objects randomly.this is the script:
for obj in $ do (
randX = random 2.0 4.0
randY = random 2.0 4.0
move obj [randX,randY,0]
randRot=random 0 360
rotRand= eulerangles 0 randRot 0
rotate $ rotRand
)
but when i apply it, it just works for the move, it aassignd different values for every object.however, with rotation and scale it applies the same value to all objects. why is this? why only move works and the other ones not? i tried with primitives and mesh objects, is the same.
if somebody can give me a hand i will really appreciate it, since the start in any matter is always harsh.
thanks in advance.
Change rotate $ rotRand to rotate obj rotRand.
$ refers to the entire selection, whereas obj in this case is the iterator that refers to each object in that selection.
Hope that makes sense.
Dave
You are using the $ value in your loop rather than the obj value, therefore applying the rotation and scale to all the objects in the selection. Change $ to obj in the loop and you should be fine.
EDIT: You just snuck in there before me Dave!
so that was it! thank you very much!
i,m not very clear yet about the iterator, i’ll search in the reference…
i’m actually learning actionscript and the mixture with maxscript is killing me…
thank you all!