Script to follow planets

Have a question about using Celestia? Check here first for FAQs and helpful advice.
Forum rules
Please help to make this forum more useful by checking the FAQs before posting! Keep it clean, keep it civil, keep it truthful, stay on topic, be responsible, share your knowledge.
Topic author
posfan12
Posts: 24
Joined: 01.07.2010
With us: 14 years 4 months

Script to follow planets

Post #1by posfan12 » 25.09.2018, 03:45

I am just starting learning how to script Celestia. I am trying to place the camera above the Earth, looking directly down on it. However, instead of sitting above the Earth's North Pole, I want to be oriented with the parent frame. In other words, the camera should be perpendicular to the XY plane of the ecliptic. Here's what I have so far:

Code: Select all

setframe
{
   ref "Sol"
   target "Earth"
   coordsys "ecliptical"
}
select { object "Earth" }
gotolonglat
{
   time 5
   distance 5
   up [0 1 0]
   longitude 0
   latitude 90
}


But it is not working. Instead of the ecliptic, the camera is aligned with the pole axis. Could someone knowledgeable help? Thanks.
Last edited by posfan12 on 27.09.2018, 21:51, edited 1 time in total.

Avatar
Croc M
Forum Admin
Posts: 437
Joined: 10.08.2016
With us: 8 years 3 months
Location: Udomlya, Tver region, Russia

Post #2by Croc » 25.09.2018, 04:30

Creator of the GUI "Lua Universal Tools"
25/V/1947 - 30/III/2019

Topic author
posfan12
Posts: 24
Joined: 01.07.2010
With us: 14 years 4 months

Post #3by posfan12 » 27.09.2018, 21:46

I have created these four scripts. Three of them work properly, in that the ecliptical reference frame markers are all at right angles to the camera/screen. But the script for Mars adds a bit of extra rotation, such that the blue Z axis reference frame marker is rotated slightly to the "forward" direction. Is there something wrong with that script, or did I make a false assumption regarding the reference frame? Thanks.

I am using Celestia 1.6.1.

Code: Select all

{
 #------------------------------------------------------------------
 # Written by: <your name>
 #         on: <date>
 #
 # The purpose of this script is ...
 #------------------------------------------------------------------
 # Set Celestia values (modify to meet your needs)...
 #------------------------------------------------------------------
 # Render the following objects...
 #    renderflags { set "planets" }
 
 # Unmark all objects...
     unmarkall {}
 
 # Set Field of View...
     set { name "FOV" value 30.0 }
 
 # Set Time Rate (1x, 100x, 1000x, etc.)...
     timerate { rate 1.0 }
 #------------------------------------------------------------------
 # Script Body - Your code goes here ...
 #------------------------------------------------------------------


renderflags { clear "boundaries|comettails|constellations" }
renderflags { clear "cloudmaps|galaxies|nightmaps|planets|stars" }
renderflags { clear "eclipseshadows|orbitspointstars|ringshadows" }
renderflags { clear "automag|grid" }
renderflags { clear "atmospheres" }
renderflags { set   "planets" }
renderflags { set   "markers" }

time { jd 2458383.500000 }
timerate { rate 0 }
setframe
{
   ref "Sol/Earth"
   target "Earth"
   coordsys "ecliptical"
}
select { object "Earth" }
gotoloc
{
   time 0
   position [0 100000 0]
   xrot 90
   yrot 0
   zrot 0
}

 
 #------------------------------------------------------------------
 # End of Script - Let the user know the script is done running ...
 #------------------------------------------------------------------
   print  { text "The script is finished."
            row  -3
            column 25
            duration 5 }
 
   wait   { duration 5 }
}

Code: Select all

{
 #------------------------------------------------------------------
 # Written by: <your name>
 #         on: <date>
 #
 # The purpose of this script is ...
 #------------------------------------------------------------------
 # Set Celestia values (modify to meet your needs)...
 #------------------------------------------------------------------
 # Render the following objects...
 #    renderflags { set "planets" }
 
 # Unmark all objects...
     unmarkall {}
 
 # Set Field of View...
     set { name "FOV" value 30.0 }
 
 # Set Time Rate (1x, 100x, 1000x, etc.)...
     timerate { rate 1.0 }
 #------------------------------------------------------------------
 # Script Body - Your code goes here ...
 #------------------------------------------------------------------


renderflags { clear "boundaries|comettails|constellations" }
renderflags { clear "cloudmaps|galaxies|nightmaps|planets|stars" }
renderflags { clear "eclipseshadows|orbitspointstars|ringshadows" }
renderflags { clear "automag|grid" }
renderflags { clear "atmospheres" }
renderflags { set   "planets" }
renderflags { set   "markers" }

time { jd 2458383.500000 }
timerate { rate 0 }
setframe
{
   ref "Sol/Mars"
   target "Mars"
   coordsys "ecliptical"
}
select { object "Mars" }
gotoloc
{
   time 0
   position [0 100000 0]
   xrot 90
   yrot 0
   zrot 0
}

 
 #------------------------------------------------------------------
 # End of Script - Let the user know the script is done running ...
 #------------------------------------------------------------------
   print  { text "The script is finished."
            row  -3
            column 25
            duration 5 }
 
   wait   { duration 5 }
}

Code: Select all

{
 #------------------------------------------------------------------
 # Written by: <your name>
 #         on: <date>
 #
 # The purpose of this script is ...
 #------------------------------------------------------------------
 # Set Celestia values (modify to meet your needs)...
 #------------------------------------------------------------------
 # Render the following objects...
 #    renderflags { set "planets" }
 
 # Unmark all objects...
     unmarkall {}
 
 # Set Field of View...
     set { name "FOV" value 30.0 }
 
 # Set Time Rate (1x, 100x, 1000x, etc.)...
     timerate { rate 1.0 }
 #------------------------------------------------------------------
 # Script Body - Your code goes here ...
 #------------------------------------------------------------------


renderflags { clear "boundaries|comettails|constellations" }
renderflags { clear "cloudmaps|galaxies|nightmaps|planets|stars" }
renderflags { clear "eclipseshadows|orbitspointstars|ringshadows" }
renderflags { clear "automag|grid" }
renderflags { clear "atmospheres" }
renderflags { set   "planets" }
renderflags { set   "markers" }

time { jd 2458383.500000 }
timerate { rate 0 }
setframe
{
   ref "Sol/Saturn"
   target "Saturn"
   coordsys "ecliptical"
}
select { object "Saturn" }
gotoloc
{
   time 0
   position [0 1000000 0]
   xrot 90
   yrot 0
   zrot 0
}

 
 #------------------------------------------------------------------
 # End of Script - Let the user know the script is done running ...
 #------------------------------------------------------------------
   print  { text "The script is finished."
            row  -3
            column 25
            duration 5 }
 
   wait   { duration 5 }
}

Code: Select all

{
 #------------------------------------------------------------------
 # Written by: <your name>
 #         on: <date>
 #
 # The purpose of this script is ...
 #------------------------------------------------------------------
 # Set Celestia values (modify to meet your needs)...
 #------------------------------------------------------------------
 # Render the following objects...
 #    renderflags { set "planets" }
 
 # Unmark all objects...
     unmarkall {}
 
 # Set Field of View...
     set { name "FOV" value 30.0 }
 
 # Set Time Rate (1x, 100x, 1000x, etc.)...
     timerate { rate 1.0 }
 #------------------------------------------------------------------
 # Script Body - Your code goes here ...
 #------------------------------------------------------------------


renderflags { clear "boundaries|comettails|constellations" }
renderflags { clear "cloudmaps|galaxies|nightmaps|planets|stars" }
renderflags { clear "eclipseshadows|orbitspointstars|ringshadows" }
renderflags { clear "automag|grid" }
renderflags { clear "atmospheres" }
renderflags { set   "planets" }
renderflags { set   "markers" }

time { jd 2458383.500000 }
timerate { rate 0 }
setframe
{
   ref "Sol/Uranus"
   target "Uranus"
   coordsys "ecliptical"
}
select { object "Uranus" }
gotoloc
{
   time 0
   position [0 300000 0]
   xrot 90
   yrot 0
   zrot 0
}

 
 #------------------------------------------------------------------
 # End of Script - Let the user know the script is done running ...
 #------------------------------------------------------------------
   print  { text "The script is finished."
            row  -3
            column 25
            duration 5 }
 
   wait   { duration 5 }
}


Added after 11 hours 9 minutes:
Are Mars and Venus perhaps placed in other parent reference frames than the ecliptic, thus screwing up the orientation of the Frame Axes markers?


Return to “Help Central”