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

setposition
setposition { base  offset  } 

-- OR --

setposition { x  y  z  } 

Moves the camera to a specific position in the 3-dimensional universe. If you are attempting to duplicate a position based on a Bookmark or Cel://URL, you will also need to set the proper Coordinate System, orientation, and other parameters. (Also see seturl).

-- OR --

CELX equivalent-1:

Based on parameter list-1 and the celestia:newposition, celestia:newvector, position:addvector and observer:gotolocation methods.


 * Create new position object from ,  and  and store in "pos". The units of the components of a position object are millionths of a light-year, so you have to convert light-year in a Celestia Bookmark to millionths of a light-year in a CELX position object.

pos = celestia:newposition(  * 1e6,  * 1e6,  * 1e6 )


 * Create new vector object from ,  and  and store in "vec". The units of the components of a vector object are millionths of a light-year, so you have to convert light-year in a Celestia Bookmark to millionths of a light-year in a CELX vector object.

vec = celestia:newvector(  * 1e6,  * 1e6, <zoffsetnum> * 1e6 ) tarpos = pos:addvector(vec)
 * Add new position object and new vector object and store in "tarpos".


 * Get observer instance of the active view and goto "tarpos" in zero seconds.

obs = celestia:getobserver obs:gotolocation(tarpos, 0.0 )

Note: In this equivalent, the observer goes to a position releative to the current frame of reference. If the current frame of reference is "universal", the observer:setposition method may also be used instead of the observer:gotolocation method.

Summarized:

pos = celestia:newposition( <xnumber> * 1e6, <ynumber> * 1e6, <znumber> * 1e6 ) vec = celestia:newvector( <xoffsetnum> * 1e6, <yoffsetnum> * 1e6, <zoffsetnum> * 1e6 ) tarpos = pos:addvector(vec) obs = celestia:getobserver obs:gotolocation(tarpos, 0.0 ) wait(0.0)

CELX equivalent-2:

Based on parameter list-2 and the celestia:newposition(base64) and observer:gotolocation methods.


 * Create new position object from URL-style Base64-encoded values and store in "pos". <xbase64>: The X-component of the new vector, as a string-values taken from a cel style URL ?x= . <ybase64>: The Y-component of the new vector, as a string-values taken from a cel style URL &y= . <zbase64>: The Z-component of the new vector, as a string-values taken from a cel style URL &z=.

pos = celestia:newposition( <xbase64>, <ybase64>, <zbase64> )


 * Get observer instance of the active view and goto "pos" in zero seconds.

obs:gotolocation(pos, 0.0 )

Note: In this equivalent, the observer goes to a position releative to the current frame of reference. If the current frame of reference is "universal", the observer:setposition method may also be used instead of the observer:gotolocation method.

Summarized:

pos = celestia:newposition( <xbase64>, <ybase64>, <zbase64> ) obs = celestia:getobserver obs:gotolocation(pos, 0.0 ) wait(0.0)

Example-1: Position the camera to a position in space outside of the Milky Way, according parameterlis-1 :

CEL:

setposition { base [-64132.43 47355.11  196091.57] offset [ 0  0  -1.52e-005 ] }

CELX with the celestia:newposition, celestia:newvector, position:addvector and observer:gotolocation methods, based on parameter list-1 :

pos = celestia:newposition( -64132.43 * 1e6, 47355.11 * 1e6, 196091.57 * 1e6 ) vec = celestia:newvector( 0, 0, -1.52e-005 * 1e6 ) tarpos = pos:addvector(vec) obs = celestia:getobserver obs:gotolocation(tarpos, 0.0) wait(0.0)

-- OR -- (If current frame of reference is "universal")

pos = celestia:newposition( -64132.43 * 1e6, 47355.11 * 1e6, 196091.57 * 1e6 ) vec = celestia:newvector( 0, 0, -1.52e-005 * 1e6 ) tarpos = pos:addvector(vec) obs = celestia:getobserver obs:setposition(tarpos) wait(0.0)

Example-2: Position the camera to the same position in space outside of the Milky Way, according parameterlis-2.

Note: The CelURL values in this example are compatible with Celestia version.

CEL:

setposition { x "AMDCXoJK/3+IyGgR8f///w" y "BvP2LRdAAAD/n5UGCw" z "VUrGoeQJ+/8DyvenLQ" }

CELX with the celestia:newposition(base64) and observer:gotolocation methods, based on parameter list-2 :

pos = celestia:newposition("AMDCXoJK/3+IyGgR8f///w","BvP2LRdAAAD/n5UGCw","VUrGoeQJ+/8DyvenLQ" ) obs = celestia:getobserver obs:gotolocation(pos, 0.0) wait(0.0)

-- OR -- (If current frame of reference is "universal")

pos = celestia:newposition("AMDCXoJK/3+IyGgR8f///w","BvP2LRdAAAD/n5UGCw","VUrGoeQJ+/8DyvenLQ" ) obs = celestia:getobserver obs:setposition(pos) wait(0.0)

Back to CEL command index