Newbie trying to use object reference frame totally lost

All about writing scripts for Celestia in Lua and the .cel system
Topic author
rbroberts
Posts: 23
Joined: 05.11.2006
With us: 17 years 6 months
Location: Brooklyn, NY

Newbie trying to use object reference frame totally lost

Post #1by rbroberts » 30.01.2008, 18:20

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
Roland B. Roberts, PhD
6818 Madeline Court
Brooklyn, NY 11220

Topic author
rbroberts
Posts: 23
Joined: 05.11.2006
With us: 17 years 6 months
Location: Brooklyn, NY

Post #2by rbroberts » 01.02.2008, 20:24

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
Roland B. Roberts, PhD

6818 Madeline Court

Brooklyn, NY 11220

Topic author
rbroberts
Posts: 23
Joined: 05.11.2006
With us: 17 years 6 months
Location: Brooklyn, NY

Post #3by rbroberts » 03.02.2008, 05:22

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)?
Roland B. Roberts, PhD

6818 Madeline Court

Brooklyn, NY 11220

Avatar
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 5 months

Post #4by Chuft-Captain » 03.02.2008, 08:58

Code: Select all

Class  "Invisible"
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

Topic author
rbroberts
Posts: 23
Joined: 05.11.2006
With us: 17 years 6 months
Location: Brooklyn, NY

Post #5by rbroberts » 04.02.2008, 03:05

Perfect! Thanks!
Roland B. Roberts, PhD

6818 Madeline Court

Brooklyn, NY 11220


Return to “Scripting”