跳轉至內容

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

來自華夏公益教科書,自由的教科書

chase { }

告訴 Celestia 將活動座標系設定為chase,它會追隨當前選中的物件穿越太空。

該命令沒有引數。


CELX 等效-1

基於 observer:setframe() 方法。

  • 找到名為 <string> 的目標物件,作為追隨物件並存儲在 "objectname" 中。
objectname = celestia:find( <string> )
  • 建立一個新的追隨參考系,以 "objectname" 作為參考物件,並存儲在 "frame" 中。
frame = celestia:newframe("chase", objectname)
  • 獲取活動檢視的觀察者例項,並將參考系的座標系設定為 "frame"。
obs = celestia:getobserver()
obs:setframe(frame)

總結

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


CELX 等效-2

基於 observer:chase() 方法。

  • 找到名為 <string> 的目標物件,作為追隨物件並存儲在 "objectname" 中。
objectname = celestia:find( <string> )
  • 獲取活動檢視的觀察者例項,並激活 "objectname" 上的追隨模式。
    追隨模式與將參考系設定為以 objectname 作為參考物件的追隨模式相同。
obs = celestia:getobserver()
obs:chase(objectname)

總結

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

示例

以下示例選擇月球,將座標系設定為chase,然後前往月球。

CEL

select { object "Sol/Earth/Moon" }
chase  { }
goto   { time 2 }
wait   { duration 2 }

CELX-1 使用 observer:setframe() 方法

moon = celestia:find("Sol/Earth/Moon")
celestia:select(moon)
frame = celestia:newframe("chase", moon)
obs = celestia:getobserver()
obs:setframe(frame)
obs:goto(moon, 2.0)
wait(2.0)

CELX-2 使用 observer:chase() 方法

moon = celestia:find("Sol/Earth/Moon")
celestia:select(moon)
obs = celestia:getobserver()
obs:chase(moon)
obs:goto(moon, 2.0)
wait(2.0)

返回 CEL 命令索引

華夏公益教科書