Jump to content

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

From Wikibooks, open books for an open world

chase

[edit | edit source]

chase { }

Tells Celestia to set the active Coordinate System to chase, which chases the currently selected object through space.

The command has no arguments.


CELX equivalent-1:

Based on the observer:setframe() method.

  • Find the target object with name <string> to be chased and store in "objectname".
objectname = celestia:find( <string> )
  • Create new frame of reference to chase with "objectname" as reference object and store in "frame".
frame = celestia:newframe("chase", 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("chase", objectname)
obs = celestia:getobserver()
obs:setframe(frame)


CELX equivalent-2:

Based on the observer:chase() method.

  • Find the target object with name <string> to be chased and store in "objectname".
objectname = celestia:find( <string> )
  • Get observer instance of the active view and activate chase-mode on "objectname".
    Chase-mode is the same as setting the frame of reference to chase with objectname as reference object.
obs = celestia:getobserver()
obs:chase(objectname)

Summarized:

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

Example:

The following example selects the Moon, sets the Coordinate System to chase, and then goes to the Moon:

CEL:

select { object "Sol/Earth/Moon" }
chase  { }
goto   { time 2 }
wait   { duration 2 }

CELX-1 with observer:setframe() method:

moon = celestia:find("Sol/Earth/Moon")
celestia:select(moon)
frame = celestia:newframe("chase", moon)
obs = celestia:getobserver()
obs:setframe(frame)
obs:goto(moon, 2.0)
wait(2.0)

CELX-2 with observer:chase() method:

moon = celestia:find("Sol/Earth/Moon")
celestia:select(moon)
obs = celestia:getobserver()
obs:chase(moon)
obs:goto(moon, 2.0)
wait(2.0)

Back to CEL command index