透過Mouse event的設定,可直接觸發VFX,並控制VFX的座標及噴發位置

1.在VFX的編輯器中,在Spawn的Node的Start接點,新增一個Event的node,並先將Event Name取名,供後續使用。Send的功能,就是測試使用。

2.在Initialize的Node中新增Set Position的Block,目的是要控制每一個粒子的噴發位置,從Position的端點拉出建立控制參數(Get Attribute:position(Source)),再調整Location參數從Current切換至Source,可透過此方式從mouse的座標進行噴發。

3.在Hierarchy建立一個3D Object-mousecontrol,目前以plane和mirror進行實作會成功透過mouse event控制,部份3D Object-Cube/Sphere/Cylinder目前會失敗。

4.將剛設定mouse event的VFX拉入Hierarchy中。

5.點選在Hierarchy中的plane,在Inspector中加入VFX Mouse Even Binder(Script),可以透過這個指令用mouse event控制VFX,但目前實驗結果只能適用於3D object,若還有其他物件可使用,會再更新實驗結果。
將Hierarchy下的Mousecontrol拉入VFX Mouse Even Binder(Script)中的Target參數,Event name就是與剛在VFX取名為同名,Activation的mouse event控制參數有On Mouse up/On Mouse Down/On Mouse Enter/On Mouse Exit/On Mouse Over/On Mouse Drag。在這次練習中選擇最常用的On Mouse Down和On Mouse Over進行測試。


