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

< Celestia < Celx Scripting < CELX Lua Methods

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.

objectname = celestia:find( <string> )
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.

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)


Back to CEL command index

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.