Celestia/Celx Scripting/CELX Lua Methods/CEL command track
track
edittrack { }
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() obs:track(objectname)
Summarized:
objectname = celestia:find( <string> ) obs = celestia:getobserver() obs:track(objectname)
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() obs:track(nil)
Example:
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.
CEL:
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() obs:cancelgoto() obs:track(nil) obs:setframe(celestia:newframe("universal")) earth = celestia:find("Sol/Earth") celestia:select(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) obs:track(earth) celestia:settimescale(1000)