2009-01-16

OpenBVE 動態物件注意要點 [未完成: 1之3]


OpenBVE 動態物件注意要點

參閱
  1. openBVE : ‘The Animated Object Format
  2. demoroute.csv (Michelle, 2008)
  3. Demo route 物件各個txt (Michelle, 2008)
構成
  1. 一個.animated檔(下稱物件組合),內容指向若干個b3d, csv x 檔。組合內的不同物件分為靜止和可動的。
  2. 在路線檔structure 部分, .freeobj(x) 定義物件, 指向一個animated檔。
  3. 在路線檔 route 部分, .freeobj放入物件。
闡述
1. Txt檔物件組合
l 位置: Position = X, Y, Z
l 四種動作: States, Translate, Rotate, Texture Shift
States:
l 必須, 如果要利用states 動作, 導入一個以上的b3d / csv / x。否則,導入一個即可。
l 如果function 等於 0,1,2,3 等整數, 0, 1, 2, 3 states 裡引用的物件會顯示。
[Object]
States = light_on.b3d, light_off.b3d
StateFunction = distance > 150[Stephen1]
Translate
l TranslateXDirection = 1, 0, 0 (預設)x軸動作向右移動
l TranslateYDirection = 0, 1, 0 (預設)y軸動作向上移動
l TranslateZDirection = 0, 0, 1 (預設)z軸動作向前移動
l TranslateZDirection = 0, 0, - 2 z軸動作向移動兩倍
l 一個translate direction配合一個translate function
[object]
TranslateXDirection = -10[Stephen2] , 0, 0
TranslateXFunction = cos[Stephen3] [time[Stephen4] ]
Rotate
l RotateZDirection, RotateZFunction, (RotateZDamping) (X, Y同樣)
l RotateZFunction定義為計算逆時針方向的弧度(radian)
[Object]
States = Second.b3d
RotateZ[Stephen5] Direction = 0, 0, -[S6] 1
RotateZFunction = floor[Stephen7] [time[S8] ] *0.10471975511966
;RotateZDamping = 20[Stephen9] , 0.4[Stephen10]
Texture shift
l 類似網頁的走馬燈功能, 可以橫向或縱向移動
l 橫向如列車資訊屏; 縱向如扶手電梯梯級。
l TextureShiftXDirectionTextureShiftXFunction 為一對。Y亦同。
l TextureShiftXDirection預設為1,0 即向右; Y則向上。
l TextureShiftXFunction只會把算式結果的小數留下, 作為相對的移動幅度。
[Object]
States = Display.b3d [S11]
TextureShiftXFunction = 0.05[S12] *time
2. With structure .animatedobj
.......
3. With route .animatedobj(x)
......


[Stephen1]如果 distance 大於150會給出1, 否則算出0
Distance 是內設變數, 表示路線某點與首車距離。

[Stephen2]向左移10倍。由於-1,要倍大才可看到它的動作。

[Stephen3]Cosine(time)

[Stephen4]由午夜至現時的系統時間 ()

[Stephen5]沿z軸旋轉(即面向旋轉平面)

[S6]由於功能定義為計算反方向弧度rad, 所以上一句direction 要加負號抵消。

[Stephen7]截斷至個位數

[S8]由於此time變量不是每秒才更新一次, 如果不截斷至個位數, 動作會連續進行。

[Stephen9]Damping angular frequency=20

[Stephen10]40% damping

[S11]缺省direction, 即向右。

[S12]將移動幅度倍減至每秒總bitmap 長度的5%

沒有留言: