Hello,
I'm still working on my script (some topics ago i had a question) And i got stuck agian. Im trying to create a moon...its orbit around a planet moves ofcourse with the planets orbit. So i want either
1) to path-constrain orbit1 to orbit2, or (the better option)
2) to link the orbit to the planet.
Problem here seems (aside from the syntax which i still have trouble learning) that this parent-orbit or parent-planet is created in the same if-loop.
the next loop works just as expected, all orbits are centered around [0,0,0]...... sofar so good
/* ExampleArray = #(name,center,type,other) */
Plt = #(#("Jupiter", "Origin", "Planet","Other Properties"),\
#("Io", "Jupiter", "Moon","Other Properties"))
for i=1 to Plt.count do
(
orbit1 = ellipse()
orbit1.name = "Orbit of " + Plt[i][1]
--some more lines setting properties of Orbit1 here i left out for easy reading
globe = sphere()
--some more lines setting properties of globe here i left out for easy reading
globe.pos.controller = Path_Constraint()
globe.pos.controller.path = orbit1
)
Now, i'd like to get the moon-orbit to move around the orbit of its parent Option1). i could just create a seperate ellipse for this, but that would mean is get multiple identical ellipses. I'd rather select and use the existing one. The next script doesnt work...
i have an idea why, but don't know how to do it right
for i=1 to Plt.count do
(
orbit1 = ellipse()
orbit1.name = "Orbit of " + Plt[i][1]
--some more lines setting properties of Orbit1 here i left out for easy reading
globe = sphere()
--some more lines setting properties of globe here i left out for easy reading
if Plt[i][3]=="Moon" do (
PPath = Max Select "Orbit of " + Plt[i][2]
--this previous line is obvious the problem
orbit1.pos.controller = Path_Constraint()
orbit1.pos.controller.path = PPath
)
globe.pos.controller = Path_Constraint()
globe.pos.controller.path = orbit1
)
I tried some variations on the next loop aswell. This gave me the impression i cannot select anything created earlier in the "for i=1 to Plt.count do"-loop until the whole loop is finnished. is that correct?
if Plt[i][1][2]=="Moon" do (
LC = Link_Constraint()
Parent = Plt[i][2]
orbit1.controller = LC
orbit1.transform.controller.addTarget $Parent 0
)
Could anyone please help me out a bit?
By Ralf · 2008-12-20
Anton Berg · 2008-12-23