Celestia/Celx Scripting/CELX Lua Methods/CEL command gotolonglat

gotolonglat
gotolonglat { time  distance  up  longitude  latitude  } 

Go to the currently selected object, taking  seconds, stopping  from the object, using   orientation, positioning yourself above the specified longitude  and latitude  surface coordinates.

Note: The gotolonglat command does not reset the coordinate system. It retains the previously set coordinate system.

CELX equivalent:

Based on the observer:gotolonglat method.


 * Find the target object with name  to go to and store in "objectname". In CELX scripting it is not necessary to select "objectname".

objectname = celestia:find(  )


 * Determine the radius of "objectname" and store in "radius".

radius = objectname:radius


 * Determine distance in km to goto as:  * "radius" and store in "distance".

distance =  * radius


 * Convert  and  from degrees to radians by multiplying degrees with math.pi (= 3.14159265) and divide by 180. The Lua "math.rad" function can also be used for this.

longitude = math.rad( <longnumber> ) latitude = math.rad( <latnumber> )


 * Define a vector object, to determine which axis points up.

upaxis = celestia:newvector( <upvector> )


 * Get observer instance of the active view and go to the "longitude" and "latitude" surface coordinates at the determined "distance" from the surface of "objectname" in <duration> seconds.
 * If no <duration> is given, the default time is 5.0 seconds !!!
 * If no <distance> is given, the default is 5 times the objects radius.
 * If no <longitude> is given, the default is 0.
 * If no <latitude> is given, the default is 0.
 * If no <upvector> is given, the default is (0,1,0) --> Y.

obs = celestia:getobserver obs:gotolonglat(objectname, longitude, latitude, distance, <duration>, upaxis )


 * Wait <duration> seconds.

wait( <duration> )

Summarized:

objectname = celestia:find( <string> ) radius = objectname:radius distance = <radiusdistance> * radius longitude = math.rad( <longnumber> ) latitude = math.rad( <latnumber> ) upaxis = celestia:newvector( <upvector> ) obs = celestia:getobserver obs:gotolonglat(objectname, longitude, latitude, distance, <duration>, upaxis ) wait( <duration> )

Example: This example selects the Earth and positions the camera over Seattle, Washington, USA.

CEL:

select     { object "Sol/Earth" } synchronous { } gotolonglat { time 5 distance 3 up [0 1 0] longitude -122 latitude 47 } print      { text "Traveling to Seattle, Washington, USA." row -3 column 1 duration 5 } wait       { duration 5 } print      { text "Hovering over Seattle, Washington, USA." row -3 column 1 duration 5 } wait       { duration 5 }

CELX with observer:gotolonglat method:

earth = celestia:find("Sol/Earth") celestia:select(earth) obs = celestia:getobserver obs:synchronous(earth) earthradius = earth:radius earthdistance = 3 * earthradius longitude = -122 * math.pi/180 latitude = 47 * math.pi/180 upaxis = celestia:newvector(0,1,0) obs:gotolonglat(earth, longitude, latitude, earthdistance, 5.0, upvector) celestia:print("Traveling to Seattle, Washington, USA.", 5.0, -1, -1, 1, 3) wait(5.0) celestia:print("Hovering over Seattle, Washington, USA.", 5.0, -1, -1, 1, 3) wait(5.0)

Back to CEL command index