VERSIONS
Unity Version : 2019.1.6f1
VRTK Version : 4.0 Beta
Oculus Integraton Version : 1.40
NOTE
This documentation was created as a guide to build a basic working application in Unity for the Oculus Quest using VRTK and Oculus Integration.
This documentation was created as of September 2019 based on the Versions of Unity & SDKs as mentioned above, the steps provided below may not work for future releases. This documentation also assumes that you have experience with Unity and have all the correct Modules installed in order for this to work correctly.
Useful Links
VRTK Documentation
Input for Oculus
CONTENTS
- Steps
- Project Settings
- VRTKOculusImplementation
- OVRCameraRig
- Linked Alias Association Collection
- OVR Anchor Velocity Estimator
- Local Avatar
- Tracked Alias
- Interactors
- Assigning Buttons
- Interactable
- Oculus-ID
- ADB-Setup
- Building The Application
STEPS
- Create a new empty Project in Unity
- Change the Platform from Windows PC, Mac & Linux Standalone to Android by going to (File > Build Settings or Ctrl + Shift + B). Select Android and press Switch Platform.

- Import Oculus Integration from the Asset Store (Window > Asset Store or Ctrl + 9)
- Search for Oculus Integration in the search bar and Import.

- Once Oculus Integration has been imported a pop up will appear asking you to restart your Unity, press Restart.
- When the Project restart another pop up will appear asking you to add Key Bindings press Okay as this is required by VRTK later on.
- To check if the Key Bindings has been imported, go to (Edit > Project Settings > Input > Axes)

PROJECT SETTINGS
- The next steps involve the settings with Player Settings.
- Go to (Edit > Project Settings > Player)
- Change the Company Name and Product Name to your preference. It is recommended that you do not simply change these names in the future as it might cause errors upon Building.

- Click on Other Settings to expand it. In the Auto Graphics API select Vulkan and click on the [ – ] symbol to delete it.

- Under Identification, change the Package Name to match the Company Name & Product Name that you have set earlier. For the Minimum API Level, change it to Android 4.4 ‘KitKat’ (API Level 19)

- Next is expand XR Settings, check Virtual Reality Supported. Click on the [ + ] symbol and add Oculus.

VRTKOculusImplementation.unitypackage
- At this point, the basic setup is completed, next we have to import the additional Packages to implement VRTK. I have prepared the necessary package called VRTKOculusImplementation.unitypackage for your perusal.
- This package includes scripts that will be used in the project. These scripts are required in order to integrate VRTK with Oculus Integration.
- Download the packages in the following link, and export the package into your Unity Project.
Download Here - To export the .unitypackage go to (Assets > Import Package > Custom Package) Find the .unitypackage that you have downloaded and click Open.

- Once everything has been imported your Assets folder should look as below.

OVRCameraRig
- Now we are ready to setup. In your Assets folder, open the Scenes folder, inside the is a scene called Sample Scene, double click on that scene to open it. You can rename the scene to your own preference.
- In your Project Panel, search for OVRCameraRig, drag the OVRCameraRig Prefab into your Hierarchy.

- Select OVRCameraRig in the Hierarchy, in the Inspector change the Element under OVRManager from Gear VR Or Go to Quest and the Tracking Origin Type to Floor Level.

Linked Alias Association Collection
- Scroll down until you reach the bottom of the Inspector and press Add Component button, search for Linked Alias Association Collection in the search bar and click on it. Your OVRCameraRig now should have a Linked Alias Association Collection as a component.

- Expand OVRCameraRig in the Hierarchy, expand TrackingSpace and drag the following inside the Linked Alias Association Collection.

OVR Anchor Velocity Estimator
- We still have some missing properties to Linked Alias Association Collection. To fix this we have to add some components called OVR Anchor Velocity Estimator to the CenterEyeAnchor, LeftHandAnchor and RightHandAnchor.
- Under TrackingSpace in the Hierarchy, select CenterEyeAnchor, LeftHandAnchor and RightHandAnchor. With all 3 GameObjects selected, press Add Component button in the Inspector and search for OVR Anchor Velocity Estimator and click on it. Now all three of the selected GameObjects will have the OVR Anchor Velocity Estimator as their new component.
- With all the 3 GameObjects selected, drag the OVRCameraRig GameObject to the Relative To slot in the OVR Anchor Velocity Estimator.

- For the Tracked Game Object slot, simply drag the GameObject itself from the hierarchy inside the slot in their respective inspector as below:



Local Avatar
- In your Project Panel, search for LocalAvatar, drag the LocalAvatar Prefab as a child of your OVRCameraRig in the Hierarchy.

- Select LocalAvatar in the Hierarchy, in the Inspector, scroll down until you find Other. Set the settings as below:

Tracked Alias
- Now we need to set the Tracked Alias to identify which Head Mounted Device we are using.
- In your Project Panel, search for TrackedAlias, drag the Tracked Alias prefab into the Hierarchy.
- In the TrackedAlias Inspector, select Elements, set the size to 1 and drag the OVRCameraRig inside the Element as below:

Interactors
- At this point the setup for the HMD is ready, but we do need to put interactions to be able to interact with our environment.
- In your Project Panel, search for Interactor, drag the Interactor prefab as a child into the LeftControllerAlias and RightControllerAlias inside the TrackedAlias > Aliases > LeftControllerAlias & TrackedAlias > Aliases > RightControllerAlias in the Hierarchy.
- Feel free to hide the ExampleAvatar (the Rectangular GameObject) if you wanted to, to hide the ExampleAvatar, simply open the Interactor > ColliderContainer > ExampleAvatar. Select Example Avatar and disable the GameObject.

- Notice in the Interactor’s Inspector, there is a script called Interactor Facade which is one of the component of the Interactor.
- Inside there are Interactor Settings which we have to configure in order for the Interactor to work.

- For this we have to assign some buttons in order for it to work.
Assigning Buttons
- Before we start we need to understand the layout of the Quest Controllers Input Map in Unity. Refer to the image below. You can also refer to Input for Oculus .

- To create a button to grab an object, first we need to create an empty GameObject. Reset its transform so that the position is based at 0,0,0.
- Rename it to SecondaryHandTriggerAction.
- Notice that Secondary is for the Right Hand Controller. And we are going to assign an action when we press the Hand Trigger Button on the controller.
- Select the SecondaryHandTriggerAction in the Hierarchy, in the Inspector, click the Add Component button.
- Search for OVR Input Button Action Script and select it.
- In the OVR Input Button Action component, change the Controller to Touch, and Button to Secondary Hand Trigger.

- Expand Tracked Alias > Aliases > RightControllerAlias > Interactor in the Hierarchy.
- Assign the SecondaryHandTriggerAction to the Grab Action slot under Interactor Facade.
- Assign the RightControllerAlias to the Velocity Tracker slot.

- Expand Tracked Alias > Aliases > RightControllerAlias > Interactor in the Hierarchy.
- Assign the SecondaryHandTriggerAction to the Grab Action slot under Interactor Facade.
- Assign the RightControllerAlias to the Velocity Tracker slot.
Interactables
- As of now we have an interactor and we have assigned a button to do the interactions. Now we need to add an interactable object.
- In your Project Panel, search for Interactable.Primary_Grab.Secondary_Swap, drag the Interactable.Primary_Grab.Secondary_Swap prefab in the Hierarchy.

- Adjust the Position of the Gameobject to (0,1,1).
- Your scene should now have a cube to represent the interactable object.

- You also need to change the scale of the prefab, make sure to change the scale of the DefaultMesh inside the main parent.
- Go to your Hierarchy, select Interactable.Primary_Grab.Secondary_Swap > Meshes > DefaultMesh and change the scale to (0.5,0.5,0.5).

- Now, add a plane and rename it to ground. Adjust the scale to 10,10,10.

- Create a material by right clicking in your Project panel, (Create > Material).
- Name the material to ground.
- Click on the Ground Material in your Project Panel and change the Albedo color to your liking in the Inspector.
- Assign the material to the ground by dragging the Material to the Ground GameObject in the Scene.

- We’re almost ready to build our application.
Oculus ID
- Before building our Application, we need to setup an Oculus ID.
- Go to https://dashboard.oculus.com/
- Log In to your account, or create one.
- Select Create New App.
- Fill in the required data. Example as below

- Press Submit, you will be redirected.
- Copy the App ID.

- In your Unity Editor, Go to (Oculus > Avatars > Edit Settings).
- In the Inspector insert your Oculus App ID to the Oculus Rift App ID slot and Oculus GO/Quest or Gear VR slot.


- Next, Go to (Oculus > Platform > Edit Settings).
- Do the same in the Inspector, insert your Oculus App ID to the Oculus Rift App ID slot and Oculus GO/Quest or Gear VR slot.

ADB-Setup
- If you have already setup ADB on your PC, skip to
Building The Application - I am still working on the documentation for the ADB-Setup process. But the Youtube video below should help as well as some links.
- https://www.youtube.com/watch?v=LSypZfOChYE&t=0s
- https://androidfilehost.com/?fid=95855108297851314
Building The Application
- Assuming that your have enable sideloading apps to your Oculus Quest.
- You are now ready to build your application.
- Go to (File > Build and Run or Ctrl + B)
- Once the build has finished.
- Put on your Oculus Quest.
- Navigate to (Library > Unknown Sources)
- Find the Package Name of your application that you had set earlier.
- Make sure to try and grab the Interactable object.
- Enjoy!