Celestia スクリプト ― カメラの位置と方向 (Part 1)
天文シミュレータ Celestia では、スクリプトを使ってカメラを移動させることができます。使えるスクリプトが2種類ありまして:
- CELスクリプト (.cel)
- CELXスクリプト (.celx)
前者のCELスクリプトというのは、コマンドを逐次に並べるような形になっており、プログラミングの機能はないようです。ただ、書いたコマンドが順に実行されるだけです。
後者のCELXスクリプトの方は、 Lua 言語エンジンが使われていて、変数、制御文、関数など、一通りのプログラミング機能が使えます。
CELXスクリプトで、カメラの位置と方向の設定を実験してみました。
-- test01.celx KM_PER_MLY = 9466411.842 myearth = celestia:find("Earth") celestia:select(myearth) distance = myearth:radius() * 10.0 / KM_PER_MLY myobserver = celestia:getobserver() myframe = celestia:newframe("ecliptic", myearth) myobserver:setframe(myframe) myobserver:follow(myearth) defort = myobserver:getorientation() defpos = myobserver:getposition() -- カメラ移動 mypos = celestia:newposition( distance, 0.0, 0.0) myobserver:gotolocation(mypos, 3) wait(3) celestia:print("shot 1", 3) wait(3) -- カメラ向き設定 myrot = celestia:newrotation(celestia:newvector(0.0, 1.0, 0.0), math.pi * -0.5) myobserver:setorientation(myrot) wait(1) celestia:print("shot 2", 3) wait(3) -- 元に戻す myobserver:setorientation(defort) myobserver:setposition(defpos) celestia:print("fin", 1) wait(1)
結果は以下のようになります。
| 固定リンク
トラックバック
この記事のトラックバックURL:
http://app.f.cocolog-nifty.com/t/trackback/80472/22166534
この記事へのトラックバック一覧です: Celestia スクリプト ― カメラの位置と方向 (Part 1):



コメント