--First stop time celestia:settimescale(0) --Then get variables containing Mars, the observer and the Celestia co-ord->km conversion factors mars = celestia:find("Mars") obs = celestia:getobserver() km_per_mly=9466411.842 mly_per_km=1.0 / km_per_mly --Clear render flags & labels celestia:hide("orbits", "constellations", "boundaries", "markers", "grid") celestia:hidelabel("planets", "moons", "spacecraft", "asteroids", "comets", "constellations", "stars", "galaxies", "locations") --Preload Mars textures mars:preloadtexture() --Create arrays with the TASC generated MEX locations for each image names = { "10-089_23.57.22_VMC_Img_No_1.png", "10-089_23.58.11_VMC_Img_No_2.png", "10-089_23.58.55_VMC_Img_No_3.png", "10-089_23.59.39_VMC_Img_No_4.png", "10-090_00.00.24_VMC_Img_No_5.png", "10-090_00.01.08_VMC_Img_No_6.png", "10-090_00.01.52_VMC_Img_No_7.png", "10-090_00.02.36_VMC_Img_No_8.png", "10-090_00.03.21_VMC_Img_No_9.png", "10-090_00.04.05_VMC_Img_No_10.png", "10-090_00.04.49_VMC_Img_No_11.png", "10-090_00.05.33_VMC_Img_No_12.png", "10-090_00.06.18_VMC_Img_No_13.png", "10-090_00.07.02_VMC_Img_No_14.png", "10-090_00.07.46_VMC_Img_No_15.png", "10-090_00.08.30_VMC_Img_No_16.png", "10-090_00.09.14_VMC_Img_No_17.png", "10-090_00.09.57_VMC_Img_No_18.png", } dates = { celestia:utctotdb(2010, 03, 30, 23, 57, 22), celestia:utctotdb(2010, 03, 30, 23, 58, 11), celestia:utctotdb(2010, 03, 30, 23, 58, 55), celestia:utctotdb(2010, 03, 30, 23, 59, 39), celestia:utctotdb(2010, 03, 31, 00, 00, 24), celestia:utctotdb(2010, 03, 31, 00, 01, 08), celestia:utctotdb(2010, 03, 31, 00, 01, 52), celestia:utctotdb(2010, 03, 31, 00, 02, 36), celestia:utctotdb(2010, 03, 31, 00, 03, 21), celestia:utctotdb(2010, 03, 31, 00, 04, 05), celestia:utctotdb(2010, 03, 31, 00, 04, 49), celestia:utctotdb(2010, 03, 31, 00, 05, 33), celestia:utctotdb(2010, 03, 31, 00, 06, 18), celestia:utctotdb(2010, 03, 31, 00, 07, 02), celestia:utctotdb(2010, 03, 31, 00, 07, 46), celestia:utctotdb(2010, 03, 31, 00, 08, 30), celestia:utctotdb(2010, 03, 31, 00, 09, 14), celestia:utctotdb(2010, 03, 31, 00, 09, 57), } xarr = { -1907.905, -1931.196, -1952.042, -1972.819, -1993.999, -2014.638, -2035.207, -2055.704, -2076.593, -2096.943, -2117.220, -2137.421, -2158.002, -2178.048, -2198.015, -2217.903, -2237.710, -2256.989, } zarr = { 7615.001, 7560.499, 7511.284, 7461.811, 7410.946, 7360.952, 7310.702, 7260.197, 7208.28, 7157.26, 7105.987, 7054.461, 7001.505, 6949.472, 6897.189, 6844.657, 6791.876, 6740.056, } yarr = { -10904.135, -10916.549, -10927.300, -10937.675, -10947.894, -10957.503, -10966.729, -10975.573, -10984.219, -10992.281, -10999.955, -11007.238, -11014.281, -11020.768, -11026.859, -11032.551, -11037.843, -11042.626, } obsno = 18 obstring = "30 March 2010" --Set the initial time celestia:settime(dates[1]); --Go to Mars then write title obs:track(mars) celestia:flash("European Space Agency\nMars Express Visual Monitoring Camera\nObservation "..obstring, 15) obs:goto(mars,5) obs:goto((mars:getposition() + celestia:newvector(xarr[1], yarr[1], zarr[1]) * (mly_per_km)),5) wait(10) celestia:flash("Press 'M' for next image, 'N' for previous image.\nUse left and right arrow keys to rotate the\nplanet to the same orientation as the image.", 10) wait(10) celestia:showlabel("locations", "moons", "spacecraft") --Create a function that goes to a given image number gotoimage = function(imgno) celestia:settime(dates[imgno]) obs:setposition(mars:getposition() + celestia:newvector(xarr[imgno], yarr[imgno], zarr[imgno]) * (mly_per_km)) celestia:select(mars) obs:track(mars) celestia:flash(names[imgno], 60) end --Create a function that will go to the next image in the series next = function(goto) if (count + 1)>obsno then count = 1 else count = count + 1 end gotoimage(count) end --Create a function that will go to the previous image in the series last = function() if (count - 1)<1 then count = obsno else count = count - 1 end gotoimage(count) end --Create a counter holding the position of the current image count = 1 --Set the position to the first image gotoimage(count) --Add the necessary keyboard callback code keymap = { n = last, m = next } celestia_keyboard_callback = function(key) f = keymap[key] if f then f() return true end return false end celestia:requestkeyboard(true) repeat wait(10) until false