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

< Celestia < Celx Scripting < CELX Lua Methods

follow

follow { }

This command tells Celestia to set the Coordinate System to ecliptical, and to follow the currently selected object.

The command has no arguments.


CELX equivalent-1:

Based on the observer:setframe() method.

objectname = celestia:find( <string> )
frame = celestia:newframe("ecliptic", objectname)
obs = celestia:getobserver()
obs:setframe(frame)

Summarized:

objectname = celestia:find( <string> )
frame = celestia:newframe("ecliptic", objectname)
obs = celestia:getobserver()
obs:setframe(frame)


CELX equivalent-2:

Based on the observer:follow() method.

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

Summarized:

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

Example:
This example selects Mars, sets the Coordinate System to ecliptical (follow), and then travels to Mars.

CEL:

select { object "Sol/Mars" }
follow { }
goto   { time 2 }
wait   { duration 2 }

CELX-1 with observer:setframe() method:

mars = celestia:find("Sol/Mars")
celestia:select(mars)
frame = celestia:newframe("ecliptic", mars)
obs = celestia:getobserver()
obs:setframe(frame)
obs:goto(mars, 2.0)
wait(2.0)

CELX-2 with observer:follow() method:

mars = celestia:find("Sol/Mars")
celestia:select(mars)
obs = celestia:getobserver()
obs:follow(mars)
obs:goto(mars, 2.0)
wait(2.0)


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.