# Celestia/Celx Scripting/CELX Lua Methods/CEL command goto
### goto

goto { time <duration> distance <radiusdistance> upframe <upframestring> up <upvector> }
Moves the camera to the currently selected object, taking <duration> seconds, stopping <radiusdistance> from the object (in units of object’s radius + 1), using the <upframestring> Coordinate System, and defining the <upvector> axis that points up.
Arguments:

#### time <duration>

    The number of seconds to take going to the object. Default is 1.0 second.

#### distance <radiusdistance>

    Describes how far away from the object you want to be positioned, in units of the object's radius, plus 1. Default is 5.0. Special <radiusdistance> values are:
   * 0 (zero) is the center of the object. In version 1.3.1, using this value causes the program to incorrectly recognize further positioning values, so do not use zero.
   * 1 is the surface of the object. Traveling to the exact surface level of an object may cause some graphics cards to display random polygons on the display screen, so it is best to use a value slightly above the surface.

#### upframe <upframestring>

    Sets the specified Coordinate System. Default is "observer". The <upframestring> must have one of the following values:
   * chase
   * ecliptical
   * equatorial
   * geographic
   * lock
   * observer
   * universal

#### up <upvector>

    Defines which axis points up, X [1 0 0], Y [0 1 0] or Z [0 0 1]. Default is [0 1 0].
CELX equivalent-1:
Based on the observer:gotodistance method.
* Find and select the target object with name <string> to go to and store in "objectname".
* Get observer instance of the active view instance and set the coordinate system of the frame of reference to <upframestring>.
* Determine radius of "objectname" and store in "radius".
* Determine <distance> as: <radiusdistance> * "radius" of "objectname".
* Define a vector object, to determine which axis points up.
* Goto determined <distance> of "objectname" in <duration> seconds with <upvector> pointing up.
** <distance> is the distance from the center of target where to stop in km.
*** If no <distance> is given, the default distance = 20000 km.
*** If <distance> is smaller than the radius of the object, the goto will end within the object !!!
*** To obtain the radius of an object in km, you can use the object:radius method.
** <duration> is the number of seconds the goto should take.
*** If no <duration> is given, the default time = 5.0 seconds !!!
*** If no <upvector> = upaxis is given, the default is (0,1,0) --> Y-axis.
* Wait <duration> seconds.
Summarized:
CELX equivalent-2:
Based on the observer:goto(table) method.
Using this method, many different types of gotos can be performed. The strength of this method is that the observer orientation can be programmed, so the axis that points up after the goto can also be determined.
This method uses positions to goto, instead of a distance from the object, so that needs some additional calculations. The parameters for the goto must be given in the table:
** parameters.duration: duration (number)
** parameters.from: source position
** parameters.to: target position
** parameters.initialOrientation: source orientation
** parameters.finalOrientation: target orientation
** parameters.startInterpolation:
** parameters.endInterpolation:
** parameters.accelTime:
* Find and select the target object with name <string> to go to and store in "objectname".
* Get observer instance of the active view instance and set the coordinate system of the frame of reference to <upframestring>.
* Determine radius of “objectname” and store in “radius”.
* Determine distance in km to goto as: <radiusdistance> * "radius" and store in "distance".
* Convert the determined "distance" to "objectname" into positions as follows:
* The target observer orientation must point from the target position “topos” towards "objectname" with <upvector> as up vector:
* Define and initialize the parameter table as follows:
** Determine the number of seconds the goto should take.
** Obtain the current position of the observer.
** New position object = topos (result of 2 steps back).
** Obtain the current orientation of the observer.
** New observer orientation = torot (result of previous step).
** Start adjusting the observer orientation after 20 percent of the time to goto.
** End adjusting the observer orientation after 80 percent of the time to goto.
** Spend 10% of the time for accelerating and decelerating
* Goto target position with target orientation in <duration> seconds.
* Wait <duration> seconds.
Summarized:
Example: The following example selects Mars and takes five seconds to travel 10 times the radius of mars above the surface and Y-axis pointing up.
CEL:
CELX-1 with observer:gotodistance method:
CELX-2 with observer:goto(table) method:
Back to CEL command index