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

center
center { time  } 

Centers the currently selected object in the display in  seconds. you must first use the select command to select an object to be centered.

CELX equivalent:

Based on the observer:center method.


 * Find and select target object with name  to be centered and store in "objectname"

objectname = celestia:find(  )


 * Get observer instance of the active view and center objectname. If no  is given, the default time = 5.0 seconds !!!

obs = celestia:getobserver obs:center(objectname,  )


 * Wait  seconds.

wait(  )

Summarized:

objectname = celestia:find(  ) obs = celestia:getobserver obs:center(objectname,  ) wait(  )

Example: The following example selects the Earth and takes 5.5 seconds to center it on the screen. If you do not see the Earth, press the [G] key on your keyboard and you should see the Earth zoom into view from the center of the display.

CEL:

select { object "Sol/Earth" } center { time 5.5 }

CELX:

earth = celestia:find("Sol/Earth") celestia:select(earth) obs = celestia:getobserver obs:center(earth, 5.5) wait(5.5)

Back to CEL command index