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

< Celestia < Celx Scripting < CELX Lua Methods

setframe

setframe { ref <refstring> target <tarstring> coordsys <coordstring> }

Set the currently active Coordinate System.

Arguments:

ref <refstring>
Defines the reference (first) object. No default.
target <tarstring>
Is optional and defines the target (second) object, for 2-object coordinate systems, such as lock. No default.
coordsys <coordstring>
Default "universal".
Must be one of the following values:
  • 1.6.0 bodyfixed
  • chase
  • ecliptical
  • equatorial
  • geographic → (same as bodyfixed, maintained here for compatibility with older scripts)
  • lock
  • observer
  • universal


CELX equivalent:

Based on the celestia:newframe() and observer:setframe() methods.

objectname_ref = celestia:find( <refstring> )
celestia:select(objectname_ref)
objectname_tar = celestia:find( <tarstring> )
frame = celestia:newframe( <coordstring>, objectname_ref, objectname_tar)
obs = celestia:getobserver()
obs:setframe(frame)

Summarized:

objectname_ref = celestia:find( <refstring> )
celestia:select(objectname_ref)
objectname_tar = celestia:find( <tarstring> )
frame = celestia:newframe( <coordstring>, objectname_ref, objectname_tar)
obs = celestia:getobserver()
obs:setframe(frame)


Example:
The following example sets the Coordinate System to lock, which locks the Earth and Moon together on the display.

CEL:

setframe { ref "Sol/Earth" target "Sol/Earth/Moon" coordsys "lock" }

CELX with the celestia:newframe() and observer:setframe() methods:

earth = celestia:find("Sol/Earth")
celestia:select(earth)
moon = celestia:find("Sol/Earth/Moon")
frame = celestia:newframe("lock", earth, moon)
obs = celestia:getobserver()
obs:setframe(frame)


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.