跳轉到內容

Celestia/Celx 指令碼/CELX Lua 方法/CEL 命令同步

來自 Wikibooks,開放世界的開放書籍

synchronous { }

使當前選定的物體以同步軌道模式執行。這激活了地理1.6.0本體固定座標系。地理1.6.0本體固定座標系允許您保持在選定物體(不僅僅是地球)上方的靜止或地球同步軌道。當物體在其下方旋轉時,攝像機與其一起移動,就像它連線到物體上一樣。

地理1.6.0本體固定座標系中,軸隨選定物體一起旋轉。Y軸是旋轉軸 - 逆時針方向,因此對於像地球這樣的順行旋轉器,它指向北,對於像金星這樣的逆行旋轉器,它指向南。X軸從物體的中心指向其零經度子午線和赤道的交點。Z軸(與XY平面成直角)完成了右手座標系。因此,具有恆定地理座標的物體將相對於物體表面上的一個點保持固定。

必須首先使用select命令來選擇一個物體。

此命令沒有引數。


CELX 等效-1

基於celestia:newframe()observer:setframe()方法。

  • 找到名稱為<string>的目標物體,使其與之處於同步軌道,並存儲在“objectname”中。
objectname = celestia:find( <string> )
  • 建立新的參考系到以“objectname”為參考物體的平面座標系,並將其儲存在“frame”中。
frame = celestia:newframe("planetographic", objectname)
  • 獲取活動檢視的觀察者例項,並將參考系的座標系設定為“frame”。
obs = celestia:getobserver()
obs:setframe(frame)

總結

objectname = celestia:find( <string> )
frame = celestia:newframe("planetographic", objectname)
obs = celestia:getobserver()
obs:setframe(frame)


Celestia 版本1.6.0及更高版本的CELX 等效-2

基於celestia:newframe()observer:setframe()方法。

  • 找到名稱為<string>的目標物體,使其與之處於同步軌道,並存儲在“objectname”中。
objectname = celestia:find( <string> )
  • 建立新的參考系到1.6.0本體固定座標系,以“objectname”為參考物體,並將其儲存在“frame”中。
frame = celestia:newframe("bodyfixed", objectname)
  • 獲取活動檢視的觀察者例項,並將參考系的座標系設定為“frame”。
obs = celestia:getobserver()
obs:setframe(frame)

總結

objectname = celestia:find( <string> )
frame = celestia:newframe("bodyfixed", objectname)
obs = celestia:getobserver()
obs:setframe(frame)


CELX 等效-3

基於observer:synchronous()方法。

  • 找到名稱為<string>的目標物體,使其與之處於同步軌道,並存儲在“objectname”中。
objectname = celestia:find( <string> )
  • 獲取活動檢視的觀察者例項,並在“objectname”上啟用同步模式。
obs = celestia:getobserver()
obs:synchronous(objectname)

注意:同步模式與將參考系設定為平面座標系(也稱為地理或1.6.0本體固定)相同,其中“objectname”作為參考物體。

總結

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


示例
此示例選擇地球並將座標系設定為平面/地理/本體固定(同步)。

CEL

select { object "Sol/Earth" }
synchronous { }

使用celestia:newframe()observer:setframe()方法的CELX

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

對於Celestia版本1.6.0及更高版本,使用celestia:newframe()observer:setframe()方法的CELX

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

使用observer:synchronous()方法的CELX

earth = celestia:find("Sol/Earth")
celestia:select(earth)
obs = celestia:getobserver()
obs:synchronous(earth)


返回 CEL 命令索引

華夏公益教科書