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


track { }

Track the currently selected object, which keeps it centered in the display. The select command must be used first, to select an object to be tracked.

The command has no arguments.

Note: If you want the camera to remain at a constant distance from the object, add a follow command after the track command.

Note: If the currently selected object has track enabled, as of Celestia version 1.3.1 you can select a nil object "", followed by a track command to cancel tracking the currently selected object.

CELX equivalent start tracking:

Start tracking an object, based on the observer:track() method.

  • Find the target object with name <string> to track and store in "objectname".
objectname = celestia:find( <string> )
  • Get observer instance of the active view and set tracking on "objectname" (i.e. always keep "objectname" centered).
obs = celestia:getobserver()


objectname = celestia:find( <string> )
obs = celestia:getobserver()

CELX equivalent stop tracking:

Stop tracking an object, based on the observer:track() method.

  • Get observer instance of the active view and set tracking a nil object.
obs = celestia:getobserver()

Release your hold on any currently selected object (cancel), select the Earth (select), goto the Earth, and then track. The Earth will begin to recede from you at the speed it actually travels in space, but Celestia will track the Earth by keeping it centered in the display. The code example below demonstrates this, with time sped up by 1000x.


cancel   { }
select   { object "Sol/Earth" }
goto     { time 3 distance 7 upframe "universal" }
wait     { duration 5 }
track    { }
timerate { rate 1000 }

CELX with the observer:track() method:

obs = celestia:getobserver()
earth = celestia:find("Sol/Earth")
-- The following 2 methods are obsolete, because of methods above
-- frame = celestia:newframe("universal", earth)
-- obs:setframe(frame)
radius = earth:radius()
distance = 7 * radius
obs:gotodistance(earth, distance, 3 )
wait (5)

Back to CEL command index