Page 1 of 1

Script to follow planets

Posted: 25.09.2018, 03:45
by posfan12
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.

Posted: 25.09.2018, 04:30
by Croc

Posted: 27.09.2018, 21:46
by posfan12
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?