Celestia/Celx 指令碼/CELX Lua 方法/CEL 命令 follow
外觀
follow { }
此命令告訴 Celestia 將座標系設定為黃道,並跟隨當前選定的物體。
此命令沒有引數。
CELX 等效-1
基於 observer:setframe() 方法。
- 找到要跟隨的名稱為 <string> 的目標物體,並存儲在“objectname”中。
objectname = celestia:find( <string> )
- 建立一個新的參考系,以“objectname”為參考物體,並以黃道為參考系,並將其儲存在“frame”中。
frame = celestia:newframe("ecliptic", objectname)
- 獲取活動檢視的觀察者例項,並將參考系的座標系設定為“frame”。
obs = celestia:getobserver() obs:setframe(frame)
總結
objectname = celestia:find( <string> )
frame = celestia:newframe("ecliptic", objectname)
obs = celestia:getobserver()
obs:setframe(frame)
CELX 等效-2
基於 observer:follow() 方法。
- 找到要跟隨的名稱為 <string> 的目標物體,並存儲在“objectname”中。
objectname = celestia:find( <string> )
- 獲取活動檢視的觀察者例項,並在“objectname”上啟用跟隨模式。
跟隨模式與將參考系設定為以“objectname”為參考物體的黃道相同。
obs = celestia:getobserver() obs:follow(objectname)
總結
objectname = celestia:find( <string> ) obs = celestia:getobserver() obs:follow(objectname)
示例
此示例選擇火星,將座標系設定為黃道(跟隨),然後飛往火星。
CEL
select { object "Sol/Mars" }
follow { }
goto { time 2 }
wait { duration 2 }
CELX-1 使用 observer:setframe() 方法
mars = celestia:find("Sol/Mars")
celestia:select(mars)
frame = celestia:newframe("ecliptic", mars)
obs = celestia:getobserver()
obs:setframe(frame)
obs:goto(mars, 2.0)
wait(2.0)
CELX-2 使用 observer:follow() 方法
mars = celestia:find("Sol/Mars")
celestia:select(mars)
obs = celestia:getobserver()
obs:follow(mars)
obs:goto(mars, 2.0)
wait(2.0)