Page 1 of 1

Help controlling Celestia please!

Posted: 27.11.2006, 16:21
by urbanclearway
Hi there,

I'm a multimedia developer with a plenty of experience coding linear and Object Oriented programmes, however as great as Celestia is (and it is a cool app) I'm finding it a pain in the arse to to script.

I want to use .cel to code tours of the solar system for some eductional materials I've been asked to create. I want to then record these tours and import the movies into Flash to create presentations.

My problem though is that Celestia doesn't always react the same way to the same code. In the script below if I run it as the first script in Celestia when the tour gets to ISS you can see the edge of Earth in the background. However if I reload the script again all you see at the same point is a top down view of ISS.

This is really frustrating as really I need to be able to develop the tours in small chunks that can be brought together at the end. Otherwise I end up spending several minutes each time watching stuff I know is fine before I get to my new piece of script.

Any help/pointers with scripting .cel would be greatly appreciated as coming from full coding environments I'm struggling to understand the internal logic of Celestia.

Thanks

Barry

{
#****************************************************************************
#* Template .CEL Script for Celestia (version 1.2) *
#****************************************************************************


# How to use this template
# ------------------------
# 1. Open this file with a text editor
# 2. File/Save As the file with YOUR script file name and the .cel extension
# 3. Change any of the commands or parameters to suit your needs
# 4. Add your own Script Body code


#----------------------------------------------------------------------------
# Set Celestia to a "known state"
#----------------------------------------------------------------------------

# Cancel follow and goto commands, and set Coordinate System to Universal...
cancel { }

# Note: cancel in ver 1.3.0 does NOT clear Track, Lock or Chase, like the ESC key does,
# so we must do it manually (version 1.3.1 does this automatically)...
# select { object "" } # this works
# track { } # this works
# chase { } # this does not work
# lock { } # this does not work


# Clear the display of any left-over text from the print command...
cls { }


# Do not render the following objects...
renderflags { clear "boundaries|comettails|constellations|eclipseshadows" }
renderflags { clear "markers|orbits|pointstars|ringshadows" }
renderflags { clear "automag|grid" } # version 1.3.1+


# Render the following objects...
renderflags { set "cloudmaps|galaxies|nightmaps|planets|stars" }
renderflags { set "atmospheres" } # version 1.3.1+


# Do not label the following objects...
labels { clear "planets|moons|spacecraft|asteroids|constellations" }
labels { clear "stars|galaxies" }


# Label the following objects...
# labels { set "planets|moons|spacecraft|asteroids|constellations" }
# labels { set "stars|galaxies" }


# Unmark any objects that are currently Marked and disable Marker display...
unmarkall { } # version 1.3.1+


# Set Minimum Orbit Size...
set { name "MinOrbitSize" value 1.0 }


# Set Ambient Light Level...
# (0.0 to 1.0 is a good Lo-Hi range)...
set { name "AmbientLightLevel" value 0.10 }


# Set Field of View...
# (Celestia 1.3.0 default value is 45)
# (Celestia 1.3.1 default value is 25)
set { name "FOV" value 25.0 }


# Set Star Distance Limit...
# (Celestia default value is 1000000)
set { name "StarDistanceLimit" value 1000000 }


# For the next two Magnitude settings, Selden Ball reminds us of the following:
# "A magnitude limit of 6.5 corresponds to what you can see with the naked eye
# on a very dark night away from city lights."

# Set visible star Magnitude...
# (Celestia UI: 0.8 to 15.2, default is 6.0)
setvisibilitylimit { magnitude 6.50 }


# Set Faintest Auto-Magnitude Brightness...
# (Celestia default value is 8.5)
setfaintestautomag45deg { magnitude 8.5 }


# Set Time Rate (1x, 100x, 1000x, etc.)...
# (A negative value = Reverse Time
# 0 = Pause Time
# 1.0 = Real Time (default)
# 1000.0 = Good moon orbit motion)
timerate { rate 1.0 }


# Set Date and Time...
# U.S. Navy Calendar Date/Time to Julian Date/Time converter:
# http://aa.usno.navy.mil/data/docs/JulianDate.html
# time { jd JulianDay.JulianTime }


#----------------------------------------------------------------------------
# Start at Earth/USA (or anywhere else you want to start). You can simply
# delete this code if you don't want to use it.
#----------------------------------------------------------------------------

# Select the Earth...
select { object "sol" }

print { text "Lets start at the centre of the solar system"
row -3
column 3
duration 3 }
wait { duration 3 }

goto{
time 5
distance 15
upframe "chase"
}



orbit{
duration 20
rate 10
axis[0 1 0]
}
print { text "Lets orbit the Sun"
row -3
column 3
duration 20 }






#----------------------------------------------------------------------------
# Script Body - Your code goes here ...
#----------------------------------------------------------------------------

# time to start heading outwards
print { text "Lets work our way out from the sun..."
row -3
column 3
duration 3 }

wait{ duration 3}

print { text "Mercury is first up"
row -3
column 3
duration 3 }

# Mercury

select { object "mercury"}

goto { time 3
distance 15
}
wait{duration 3}
print { text "Welcome to Mercury, it's kind of hot here..."
row -3
column 3
duration 3 }

wait{duration 3}

print { text "don't forget your suntan lotion"
row -3
column 3
duration 3 }
orbit{
duration 20
rate 20
axis [0 1 0]
}

wait {duration 3}


print { text "Venus next"
row -3
column 3
duration 3 }

wait{duration 3}

# venus

select {object "Venus"}

goto{ time 6
distance 20
}

wait {duration 6}

print { text "Welcome to Venus"
row -3
column 3
duration 3 }

orbit{
duration 20
rate 20
axis [0 1 0]
}

# earth
print { text "Time to move on"
row -3
column 3
duration 3 }

wait{duration 2}

select { object "Earth"}

goto { time 6
distance 10
}

wait {duration 6}
print { text "Hang on this place looks familiar!!"
row -3
column 3
duration 3 }

wait {duration 3}

print { text "I wonder if you can spot your house?"
row -3
column 3
duration 10 }

orbit{duration 20
rate 20
axis [0 1 0]
}

print { text "Earth is the first planet in our solar system to have a moon"
row -3
column 3
duration 5 }

wait{duration 5}

select{object "moon"}

goto{time 3
distance 15}

print { text "oh, by the way it is actually made of cheese you know"
row -3
column 3
duration 3 }
wait{duration 3}

orbit{duration 20
rate 20
axis [0 1 0]
}


print { text "no really, honest, not edam though, good old cheddar"
row -3
column 3
duration 5 }

lookback{}
timerate{rate 0}

cancel { }
cls { }
set { name "MinOrbitSize" value 1.0 }
set { name "AmbientLightLevel" value 0.10 }
set { name "FOV" value 25.0 }
set { name "StarDistanceLimit" value 1000000 }
setvisibilitylimit { magnitude 6.50 }
setfaintestautomag45deg { magnitude 8.5 }
timerate { rate 1.0 }
time {utc "2006-11-23T21:00:00.0000"}

select { object "earth" }

goto{
time 5
distance 15
upframe "chase"
}

wait {duration 5}

orbit{
duration 5
rate 15
axis[0 1 0]
}
timerate{rate 0}
select {object "Earth/ISS"}
setframe{
ref "Earth/ISS"
target "Earth/ISS"
coordsys "equitorial"}

chase{}
goto{
time 4
distance 10
}



wait{duration 4}
center{}
#track{}
timerate{rate 100}

wait {duration 15}
print { text "Hello astronauts, seen any flying saucers today?"
row -3
column 3
duration 10 }

rotate{
duration 7
rate 15
axis [0 0 1]
}
print { text "Martin says 'Mars is boring' so lets skip it..."
row -3
column 3
duration 10 }
wait { duration 20}

rotate{
duration 7
rate -10
axis [0 0 1]
}
print { text "... and go somewhere more interesting like...Saturn!"
row -3
column 3
duration 10 }
wait { duration 10}

#timerate{rate 0}







# time for saturn
select{ object "saturn"}
goto{
time 10
distance 15}
rotate{
duration 3
rate -50
axis [0 0 1]
}
wait{duration 4}
center{}
print { text "Saturn has over 60 satellites, that's just greedy!"
row -3
column 3
duration 7 }
timerate{ rate 1000}
wait {duration 7}
labels{ set "moons"}


print { text "Here we can see some of the moons of Saturn"
row -3
column 3
duration 7 }
wait{ duration 10}
orbit{
duration 3
rate 25
axis [1 0 0]

}
wait {duration 3}
goto{ distance 100
time 3
}
wait {duration 3}

renderflags{ set "orbits"}
print { text "and their orbital paths"
row -3
column 3
duration 7 }
wait { duration 7}

#----------------------------------------------------------------------------
# End of Script - Let the user know the script is done running ...
#----------------------------------------------------------------------------

print { text "That's the end of the tour"
row -3
column 25
duration 5 }
wait { duration 15 }

}

Posted: 27.11.2006, 17:17
by selden
Don't forget that everything is moving and rotating, including the ISS. Coming toward it at a different time or from a different direction will result in it being oriented differently whan you arrive.

If you want an object to always have the same appearance in Celestia's window, you have to arrive at the same simulated time

Code: Select all

time { utc "year-month-dayTh:m:s.s" }


Alternatively, you can specify the same longitude and latitude for the viewpoint relative to the object that is selected. Although the selected object will have the same orientation, this won't guarantee that the objects in the background will be the same.

Code: Select all

gotolonglat { ... }

with these arguments, not all of which are required:
time -- number (default= 1.0)
distance -- number (default= 5.0)
up -- vector (default= [ 0 1 0 ])
longitude -- number (no default)
latitude -- number (no default)

e.g.

Code: Select all

gotolonglat { longitude 45 latitude 45 }