Unreal Blueprint 教學 - 動畫控制

首頁 > Unreal 教學 > Unreal 藍圖教學

本章的教學使用 Unreal Blueprint 藍圖為角色加入更多的動作,使用虛幻商城 10 月份免費贈送的 Close Combat Animset in Animations 資源。

先在 Content Browser 空白處按滑鼠右鍵執行 [ Animation > Animation Montage ] 建立動畫。

建立時可輸入適當的名稱(例如 Ninja_Attack),滑鼠雙擊開啟編輯此動畫。

右下方 Asset Browser 選取一個攻擊動作(例如 NinjaWheelKick 迴旋踢),拖曳到動畫時間軸。

按右上方的 Blueprint 按鈕開啟動畫藍圖,然看點選 AnimGraph 檢視動畫流程圖,目前動畫從 Default 流向 Output Pose 節點。

將原本的 Default 到 Output Pose 節點的連線刪除,,然後空白處按滑鼠右鍵,建立一個 Slot 'DefaultSlot' 節點,參考下圖建立連結。

選擇 Project Settings 開啟專案設定,選擇 Input 輸入設定。

 

新增 InputAction Attack 節點。

新增 Play Montage 節點

 

建立 InputAction Attack 節點到 Play Montage 節點的連線,玩家輸入時播放指定的動畫。

在 Play Montage 節點的 Montage to Play 選擇 Ninja_Attack 忍者攻擊動畫。

 

Variables 右側按 + 宣告變數,名稱命名為 "Combo1" 後,設定 Variable Type 變數型態為 Boolean 布林值。

重複以上步驟宣告第二個變數,名稱命名為 "Combo2" 後,設定 Variable Type 變數型態為 Boolean 布林值。