VR
VR 環境設置
-
Project Setting / XR Plug-in Management
下載 OpenXR
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
將 Project Setting / OpenXR
打開後在 Interaction Profiles
加入自己的VR裝置
將 Render Mode
改成 Multi Pass
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
下載 XR Interaction Toolkit
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
VR基礎設備設定
VR headset 頭盔轉動
-
建立一個空物件叫 VR Rig
,並未這個空物件加入新元件 XR Origin
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
為 VR Rig
物件新增一個子物件名為 Camera Offset
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
為 Camera Offset
物件新增一個Camera子物件並命名為 VR Camera
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
在VR Camera
底下新增一個新的元件 Traked Pose Driver
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
將 VR Rig
底下的 XR Origin
元件分別放入 Camera Offset
、 VR Camera
進去
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
將VR Rig
的 XR Origin
元件的欄位 Tracking Origin Mode 改為 Floor
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
VR 左右手
-
在 Camera Offset
底下建立兩個空的子物件分別命名為 Left Hand
、 Right Hand
-
選左右手物件並將兩個物件都加入 XR Controller (Device-based)
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
將 Controller Node
改成左右手
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
製作暫時的方塊雙手
-
在 Hierarchy
新增一個空的物件叫 VR Controller
,並在該物件底下新增一個子物件 3D Cube,確保VR Controller
、 Cube 的 Position
都是(0,0,0)
。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Cube參考大小
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
將 VR Controller
拉到 Project
變成 Prefab
-
將Prefab放到左右上
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
常見問題: 手臂過遠或不精準
-
解決1: 確保Cube在一個空物件底下(VR Controller
)
-
解決2: 確保VR Controller
、 Cube 的 Position
都是(0,0,0)
雙手抓取物件
-
左右手 新增元件 XR Direct Interactor
跟 Sphere Collider
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Sphere Collider
設為 trigger
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
將被抓取的物體加上 Collider
、 Rigibody
、XR Grab Interactable
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
找到手把的輸入值跟對應名稱
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Window / Analysis / XR Interaction Debugger
打開後按下 play ,操控手把即可觀察數值以及對應名稱
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
HTC VIVE 不知道為何沒辦法看到abxy按鈕的數值,但是當加入Oculus之後就可以從Oculus裡面觀察到按鈕是有被使用的,且對應的名稱是什麼。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
對應的手把按鈕
載入兩個 package : Oculus Hands
、 VR Controllers Model-FIXED
放入搖桿建模替代方形手
- 建立兩個空物件分別叫
Left Hand Presence
、Right Hand Presence
,並將以下程式碼都加入兩個物件底下。
-
在 Inspector 選擇特徵
-
左手搖桿

-
左手加入搖桿的建模

-
右手搖桿

-
右手加入搖桿的建模

-
將 Hierarchy 的兩個物件 Left Hand
、Right Hand
底下的元件Model Prefab
放入搖桿的建模


成品:

手部動畫
使用Blend Tree完成
Teleportation
-
在VR Rig
這個物件裡面加入兩個元件Locomotion System
、 Teleportation Provider
且不用幫這兩個元件的欄位放上物件,直接按play這兩個元件會自動抓取物件

-
在Camera Offset
物件新增一子物件XR / Ray Interactor
,並將名稱改為Right Teleport Ray

-
確保Right Teleport Ray
底下的XR Controller元件是(Device-based),並將Controller Node 改為右手

-
將想要移動的區域加上元件Teleportation Area
,並確保一定要有Box Collider

與物件的互動
開門
-
將整個門的物件加上此元件 XR Grab Interactable
-
接著我們要限制玩家只能在手把物件上才能抓到整個門
為門把加入Box Collider

最後將門把加入整個門的XR Grab Interactable
元件的Collider裡面,就可以限制只有用門把才可以抓取整個後門了

-
新增新的Layer,名為VR Grab Ignore Ray
。
當然我們開門並不想用射線開門,我們想用手的建模開門比起射線會有更多真實感。

-
打開Right Teleport Ray
物件並找到Raycast Mask
欄位,確保VR Grab Ignore Ray
層沒有被勾選,這樣射線只能用在UI、Ground層

-
在門上新增一元件 Hinge Joint
,將開門的方式限制只能Y方向旋轉

-
將門的XR Grab Interactable
元件裡的Movement Type改成Velocity Tracking,這樣會有物理系統的表現。

VR UI 互動
-
Canvas 的 Render Mode
必須是 World Space
。
-
為Canvas加入一個元件名子為Tracked Device Graphic Raycaster
後不需要對元件做任何事。
-
將EventSystem新增一元件XR UI Input Module
,並把不需要的刪除
