✨
Unity
  • 甚麼是Game Engine
  • 安裝Unity
  • 旋轉的方塊
  • Probuilder
  • 飄移的膠囊
  • 第三人稱視角角色控制
    • Sprint
  • Dual Sense
  • W3School(C#)
  • Variable, Operand&Operator, Data Type(C#)
  • For Loop (C#)
  • 物件導向觀念基礎 OOP
  • Rigidbody C#
  • NPC Navigation
Powered by GitBook
On this page
  • 修改步驟
  • 1. 增加Sprint的Action
  • 2. 增加變數SprintSpeed的變數
  • 3. 新增Sprint Action "On Hold" 與 "On Released"的事件
  • 4. 修改Move Action的Node
  • 5. 完成
  1. 第三人稱視角角色控制

Sprint

角色衝刺

Previous第三人稱視角角色控制NextDual Sense

Last updated 1 year ago

這篇內容是延續「第三人稱視角角色控制」的專案。

修改步驟

1. 增加Sprint的Action

在主角(Amy) Input Actions 的設定裡,增加Sprint 的Action,並且設定好Keyboard與GamePad對應的按鍵。以下圖片為範例:設定鍵盤Left Shift鍵與Play Station控制器L1鍵做為觸發Sprint Action的對應按鍵。

2. 增加變數SprintSpeed的變數

在控制主角(Amy)的Script Graph,在Object變數範圍裡新增一個"SprintSpeed"的變數。SprintSpeed變數的功能是控制角色的位移速度。

3. 新增Sprint Action "On Hold" 與 "On Released"的事件

Sprint Action 按下的時候,設定SprintSpeed變數裡的資料為2.5;Sprint Action 放開的時候,設定SprintSpeed變數裡的資料為1。

4. 修改Move Action的Node

當觸發Move Action的時候,移動的向量會乘以SprintSpeed,以確實改變角色移動的速度。

5. 完成

完整專案下載

在控制主角(Amy)的Script Graph,增加以下的Node。

LogoMicrosoft OneDrive