Skip to content

Commit f1c6e79

Browse files
authored
Merge pull request #329 from De-Panther/xri_sample_doc
Add getting started guide to the Using-XR-Interaction-Toolkit doc
2 parents 2782fce + 2071fe6 commit f1c6e79

11 files changed

+78
-1
lines changed

Documentation/Using-XR-Interaction-Toolkit.md

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Using XR Interaction Toolkit
22

33
A quick guide on using XR Interaction Toolkit with WebXR Export.
4-
For a guide on how to build and set a project, basic settings and WebGLTemplates, check the Getting Started guide.
54

65
## Sample Scene
76

@@ -21,3 +20,81 @@ The support for XR Interaction Toolkit was added using Unity 2022.3.10f1 and tes
2120
The support was built in a way that it'll be possible to use the OpenXR package in editor mode. For that the OpenXR package should be set up in the XR Plug-in Management window.
2221
Notice that the `CameraMain` is using the old `Tracked Pose Driver` instead of the one of the Input System package, due to a bug. It will create issues when using "XR Interaction Toolkit - XR Device Simulator". On those cases, you can add the new component and disable the old one when in editor.
2322
Notice that the XR Device Simulator won't work if OpenXR is enabled and the Interaction Profiles list in the OpenXR settings is not empty.
23+
24+
## Getting Started - XR Interaction Toolkit Sample
25+
26+
Create a new Unity Project (2022.3.10f1 and up). Switch platform to WebGL.
27+
28+
Import WebXR Export and WebXR Interactions packages from OpenUPM.
29+
- [WebXR Export ![openupm](https://img.shields.io/npm/v/com.de-panther.webxr?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.de-panther.webxr/)
30+
- [WebXR Interactions ![openupm](https://img.shields.io/npm/v/com.de-panther.webxr-interactions?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.de-panther.webxr-interactions/)
31+
32+
If you want to use WebXR Input Profiles to display the device controllers models, also add the WebXR Input Profiles Loader package.
33+
- [WebXR Input Profiles Loader ![openupm](https://img.shields.io/npm/v/com.de-panther.webxr-input-profiles-loader?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.de-panther.webxr-input-profiles-loader/)
34+
35+
Simplest way to do it is to set a `Scoped Registry` in `Project Settings > Package Manager` for OpenUPM.
36+
37+
```
38+
Name: OpenUPM
39+
URL: https://package.openupm.com
40+
Scope(s): com.de-panther
41+
com.atteneder
42+
```
43+
44+
The `com.atteneder` is needed when using the WebXR Input Profiles Loader package.
45+
46+
![Package Manager Settings](unity-webxr-export-package-manager-settings.png)
47+
48+
Import the packages in the Package Manager window.
49+
50+
![Package Manager - WebXR Export](unity-webxr-export-package-manager-webxr-packages.png)
51+
52+
Import the XR Interaction Toolkit package. It might ask to re-open the project when it imports the Input System package.
53+
54+
![Package Manager - XR Interaction Toolkit](unity-webxr-export-package-manager-xri.png)
55+
56+
Once Imported all the packages, import the `XR Interaction Toolkit Sample` from the WebXR Interactions package.
57+
58+
![Package Manager - WebXR Export](unity-webxr-export-package-manager-webxr-packages.png)
59+
60+
If some dependencies are missing, the `Project Validation` will open, click `Fix` on every issue and wait for it to be fixed before clicking on the next `Fix`.
61+
62+
![Project Validation](unity-webxr-export-project-validation.png)
63+
64+
Open the XR Interaction Toolkit sample scene at `Assets/Samples/WebXR Interactions/VERSION/XR Interaction Toolkit Sample/Scenes`
65+
66+
![XR Interaction Toolkit sample scene](unity-webxr-export-xri-sample.png)
67+
68+
Copy WebGLTemplates from the WebXR Export package, Go to `Window > WebXR > Copy WebGLTemplates`.
69+
70+
![Copy WebGLTemplates](unity-webxr-export-copy-webgltemplates.png)
71+
72+
After `WebGLTemplates` are in the `Assets` folder, Open the `XR Plug-in Management` tab in the `Project Settings` window and select the `WebXR Export` plug-in provider.
73+
74+
![XR Plug-in Management](unity-webxr-export-xr-plug-in-management.png)
75+
76+
Set `Background Behavior` to `Ignore Focus` in the `Input System Package` settings in the `Project Settings` window. That would make sure that the controllers tracking won't be lost when the browser tab loses focus.
77+
78+
![Input System Package settings](unity-webxr-export-input-system-package.png)
79+
80+
If using the `WebXR Input Profiles Loader`, locate the `GLTFShaderVariants`.
81+
82+
![WebXR Input Profiles Loader - Shader variants](unity-webxr-export-loader-shader-variants.png)
83+
84+
Add the `GLTFShaderVariants` to the `Preloaded Shaders` list in the Graphics settings window.
85+
86+
![WebXR Input Profiles Loader - Graphics Settings](unity-webxr-export-loader-graphics-settings.png)
87+
88+
In `Project Settings > Player > Resolution and Presentation`, select `WebXR2020` or `WebXRFullView2020` as the `WebGL Template`. (The WebXR templates with no year number are for older versions)
89+
90+
![Resolution and Presentation](unity-webxr-export-resolution-and-presentation.png)
91+
92+
Now you can build the project.
93+
94+
![Build](unity-webxr-export-build.png)
95+
96+
WebXR requires a secure context (HTTPS server or localhost URL). Make sure to build the project from `Build Settings > Build`. Unity's `Build And Run` server uses HTTP. Run the build on your own HTTPS server.
97+
98+
![Result](unity-webxr-export-xri-result.png)
99+
100+
That's it.
142 KB
Loading
143 KB
Loading
64.3 KB
Loading
131 KB
Loading
140 KB
Loading
175 KB
Loading
176 KB
Loading
56.5 KB
Loading
266 KB
Loading

0 commit comments

Comments
 (0)