[Closed] position objects on a circle
hello,
i want several objects positioned in a circle. i thought maxscript is the best way to do this, if not please tell me.
now, what i try is the following:
r=20.0
p=3.1415
for i=1 to 16 do
(
mycyl = cylinder radius:6 height:20
mycyl.name = “cyl_”+ i as string
xx=sin(p*i/16.0)r
yy=cos(pi/16.0)*r
mycyl.pos = [xx,yy,0]
)
unfortunately this doesnt work and i cant figure out why?
thanks for any help.
edit: 2 minutes after i posted this, i figured it out.
sorry.
sin is calculated from 0 to 360 degrees and not from 0 to pi as in most languages.
A couple of small notes:
In case you need Pi again some day, you can use it directly as it is already pre-defined as a System Global (sort of constant).
Also, in the function of the Circle, Cos is used to calculate the X and Sin is used for Y. You’ve got them the other way round…
this may be very embarassing, but i wud really want to understand how this works… im really eager to learn stuff like this… i guess i wasnt really paying much attention on this topic when i was in school… 🙁
sin(360*i/16.0)*r
or any of u guys can recommend a good book or site?
im looking at some stuff on the net right now, i was just hoping to hav more reference on this one… thanx in advance!