Logics

Groups

Instruction:
此範例可以和「Has Attribute」作一個比較。
當物體接收到Mouse 'OnClick'的訊息後,會產生旋轉的效果,如果再一次接收到Mouse 'OnClick'的訊息,便停止旋轉。

Building Blocks
(a) Mouse Waiter-Controllers/Mouse/Mouse Waiter
(b) Is In Group-Logics/Groups/Is In Group
(c) Remove From Group-Logics/Groups/Remove From Group
(d) Add To Group-Logics/Groups/Add To Group
(e) Set As Active Camera-Cameras/Montage/Set As Active Camera
(f) Text Display-Interface/Text/Text Display
(g) Per Second-Logics/Calculator/Per Second
(h) Group Iterator-Logics/Groups/Group Iterator
(i) Rotate-Transformations/Basic/Rotate

製作構想
在此應用了Group的觀念,利用Building Blocks-Is In Group、Remove From Group、Add To Group和Group Iterator來控制物體與Group的關係,間接控制物體的旋轉與否。

製作步驟
(a) Mouse Management

Mouse Waiter:於Edit Setting只勾選Left Button Down(如圖示)。
當'OnClick'執行後,由pOut輸出Mouse Position。

Pick Object:由Mouse Position(2D)取得3D Entity,再由pOut輸出。

Is In Group:由pIn輸入Object-3D Entity,設定Group-Rotating Objects。
判斷物體是否在Group-Rotating Objects裡,如果是,則執行Building Blocks-Remove From Group;如果否,則執行Add To Group。
Remove From Group:由pIn輸入Target-3D Entity,且設定Group-Rotating Objects;而將物體從Group-Rotating Objects裡移除。
Add To Group:由pIn輸入Target-3D Entity,且設定Group-Rotating Objects;而將物體加入Group-Rotating Objects裡。
 
(b) Camera

Set As Active Camera:設定現在所使用的Camera。
 
(c) Group Management

Per Second:設定1秒鐘所旋轉的角度值X(Turn:圈數;Degree:角度),乘上一個Frame所花費時間,在pOut輸出旋轉角度值Y。
T X(pIn) * Elapsed Time = Y(pOut) Group Iterator:設定Group-Rotating Objects,且由pOut輸出變數Element。
Rotate:於Angle of Rotation的pIn輸入旋轉角度值Y,設定Axis of Rotation-Y軸;設定Referential of the Axis-'-NULL-' (如圖示)。
新加入Group-Rotating Objects的物體都進行旋轉的動作。


愛迪斯科技股份有限公司版權所有,本網站各連結標題,商標及連結內容歸原權利人所有.
台北市內湖區民權東路六段16011樓之
2 Tel:(02)2791-2917 Fax:(02)2791-2916
CopyRight 2001-2002 Axis 3D Technology,inc. All rights reserved.