Page 1 of 1

Newbie trying to use object reference frame totally lost

Posted: 30.01.2008, 18:20
by rbroberts
I've been hunting all over but can't seem to find the "right" tutorial to get me going on this. I want to write a script that will let me view the Earth from somewhere near the L1 point in order to show both the seasonal tilt and why eclipses only happen during certain times of the year.

I found these notes

http://www.lepp.cornell.edu/~seb/celest ... tml#5.10.5

But I can't find anything that tells me how to write a script using this object reference frame, nor have I found any examples.

Can someone give me a clue, or better yet, an example?

TIA,

roland

Posted: 01.02.2008, 20:24
by rbroberts
Let me add some more and maybe someone can help.

I've created a new SSC file in celestia's data directory called "earth_lagrange.ssc" with this content lifted from Seldon's notes:

Code: Select all

"Earth L1" "Sol"
{
    Radius 4000
    Color [ 1 0 0 ]

    OrbitFrame {
         TwoVector {
            Center "Sol/Earth"
            Primary {
                Axis "x"
                RelativePosition {
                  Observer "Sol/Earth"
                  Target "Sol"
                }            }
            Secondary {
                Axis "y"
                RelativeVelocity {
                  Observer "Sol/Earth"
                  Target "Sol"
                }
            }
        }
    }

# units in AU: they should be KM since this is relative to "Sol/Earth"
#    FixedPosition [ 0.01 0 0 ]


# units in km
     FixedPosition [ 1500000 0 0 ]

}


So how to I look up and use this frame in a celx script? This is wrong, but is the idea I have in mind:

Code: Select all

obs   = celestia:getobserver()
L1    = celestia:newframe("observer", "Earth L1")
pos   = obs:getposition()
pos.x = 0
pos.y = 0
pos.z = 0
obs:goto(pos)
earth = celestia:find("Earth")
obs:follow(earth)
flash("Welcome to "..L1:name())


I want to go to the origin of that coordinate system than look at Earth. Help!

TIA,
roland

Posted: 03.02.2008, 05:22
by rbroberts
Okay, I've figured out that what this is really doing is creating an object tied to that reference frame. So now I've got something that kind of works.

Code: Select all

"Earth-L1" "Sol/Earth"
{
    Class  "Moon"
    #Mesh  ""
    Color  [ 0 0 1 ]
    Radius  0.001

    OrbitFrame
    {
        TwoVector
        {
            Center  "Sol/Earth"
            Primary
            {
                Axis "x"
                RelativePosition { Target "Sol" }
            }
            Secondary
            {
                Axis "y"
                RelativeVelocity { Target "Sol" }
            }
        }
    }

    FixedPosition [ 1496553.588 0. 0 ]
}


with this script

Code: Select all

obs   = celestia:getobserver()
L1    = celestia:find("Earth-L1")
earth = celestia:find("Earth")
sol   = celestia:find("Sol")
obs:goto(sol)
wait(5)
obs:goto(earth)
wait(5)
obs:goto(L1)
wait(5)
celestia:flash("Welcome to "..L1:name())
obs:follow(L1)
wait(5)
obs:center(earth)
obs:track(earth)


This does almost what I want. The last problem I've got is that fake moon. I really don't want anything at that location; I want the observer to be at that location. Because I've got something sitting there, I end up having it come into my field of view once every orbit due to the way the observer ends up sitting at a fixed offset from the object.

How can I get rid of the object (or make it invisible, or specify my location so it stays on the Earth-side of the object)?

Posted: 03.02.2008, 08:58
by Chuft-Captain

Code: Select all

Class  "Invisible"

Posted: 04.02.2008, 03:05
by rbroberts
Perfect! Thanks!