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

From Wikibooks, open books for an open world
Jump to navigation Jump to search

follow[edit | edit source]

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.

  • Find the target object with name <string> to be followed and store in “objectname”.
objectname = celestia:find( <string> )
  • Create new frame of reference to ecliptic with "objectname" as reference object and store in "frame".
frame = celestia:newframe("ecliptic", objectname)
  • Get observer instance of the active view and set the coordinate system of the frame of reference to "frame".
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.

  • Find the target object with name <string> to be followed and store in "objectname".
objectname = celestia:find( <string> )
  • Get observer instance of the active view and activate follow-mode on "objectname".
    Follow-mode is the same as setting the frame of reference to ecliptic with "objectname" as reference object.
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