Jump to content

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

From Wikibooks, open books for an open world

lookback

[edit | edit source]

lookback { }

Change the current camera view by 180 degrees (like a rear-view mirror).

The command has no arguments.


CELX equivalent:

Based on the observer:rotate() method.

  • Define the axis up_vector for rotation and store in "up_vec".
up_v = celestia:newvector(0,1,0)
  • Create new rotation around "up_vec" axis by 180 degrees = math.pi = 3.14159265 radians and store in "lookback".
lookback = celestia:newrotation(up_v, math.pi)
  • Get observer instance of the active view and rotate observer according the new created rotation "lookback".
obs = celestia:getobserver()
obs:rotate(lookback)

Summarized:

up_v = celestia:newvector(0,1,0)
lookback = celestia:newrotation(up_v, math.pi)
obs = celestia:getobserver()
obs:rotate(lookback)


Example:
See the above CELX equivalent also as the CELX example for CEL: lookback { }.

CEL:

lookback { }

CELX with the observer:rotate() method:

up_v = celestia:newvector(0,1,0)
lookback = celestia:newrotation(up_v, math.pi)
obs = celestia:getobserver()
obs:rotate(lookback)


Back to CEL command index