ScriptSpot

Forum topic · General Scripting

Converting Polar coordinates in Euler Angles

By Any · 2013-05-10

Description

Imagine you have scene, sun arising.

In center we have a rotation point ($PointRotate01) with [0,0,0] coordinate, and light ($Omni01) with [50,0,0] coordinate.

And $Omni01.parent = $PointRotate01

The light roll about world center, like the sun.

As issue we have array ARISE ANGLES.
arrayArise=#(0,1,2,…… 90)

I want make animation sun arising, use only ARISE ANGLES. In 0 frame, I have 0 degrees arise angel,
in 1 frame I have 1 degrees arise angel, ….., and so on.

I tray use Euler Angles.
--------------------------------------------------------------
for t=0 to animationRange.end do
(
sliderTime=t
at time t
rot_sun=eulerangles 0 t 0
animate on
(
rotate $Point01 rot_sun
)
)
--------------------------------------------------------------
Or
-------------------------------------------------------------
for t=0 to animationRange.end do
(
sliderTime=t
at time t
default=eulerangles 0 0 0
rot_sun=eulerangles 0 t 0
animate on
(
rotate $Point01 default
rotate $Point01 rot_sun
)
)
--------------------------------------------------------------
…. And getting strange result.

Help me ……

Comments (9)

how about this

barigazy · 2013-05-10


delete objects
prt = Point name:"PointRotate" axistripod:on cross:off size:10
lght = Omnilight name:"Sun" pos:[50,0,0] parent:prt
prt[3][2][2].track = float_script ()
prt[3][2][2].track.script = "-(degtorad F)"
max time play

Barigazy, glad to listen you

Any · 2013-05-10

Can you explain me
'prt[3][2][2].track = float_script ()'
expression?

Is this prt[3][2][2].track some matrix?

Send me referense on MaxScript Help topic, one more time, please...
Andrey

One more....

Any · 2013-05-10

Your variant is good when FRAME in animation = Degree
If I have the angels array AngelsArray=#(15, 26, 35, 15.7,....60) and in ferst key of animation, rotation must be AngelsArray[1], in
second key AngelsArray[2], and so on?????????

barigazy · 2013-05-10

are you need method with script controller or method with animation keys?

method with animation keys

barigazy · 2013-05-10


delete objects
angleArr = #(15,20,5,18,23,56,78,90,65,32,11,41)
prt = Point name:"PointRotate" axistripod:on cross:off size:10
lght = Omnilight name:"Sun" pos:[50,0,0] parent:prt
for t = 0 to angleArr.count-1 do
(
with animate on at time t
(
-- rotate about Y axis
prt[3][2][2].value = angleArr[t+1]
)
)

Barigazy, You ara RIGHT again.

Any · 2013-05-11

Thak you vary mutch....

One more question

Any · 2013-05-10

If I have rotation point prt on X and Z axis simultaneously, how will bee find next part your script?

prt[3][2][2].track = float_script ()
prt[3][2][2].track.script = "-(degtorad F)"

:)

barigazy · 2013-05-10

It's simple just use instanced float script in both Y and Z track ei.controller

delete objects
prt = Point name:"PointRotate" axistripod:on cross:off size:10
lght = Omnilight name:"Sun" pos:[50,0,0] parent:prt
prt[3][2][2].track = prt[3][2][3].track = float_script ()
-- now both track use same float script and you need to assigne expression in one controller
prt[3][2][2].track.script = "-(degtorad F)"
max time play