Any views expressed within media held on this service are those of the contributors, should not be taken as approved or endorsed by the University, and do not necessarily reflect the views of the University in respect of any particular issue.

Hardware: VR Equipment and Connection

 

I am mainly responsible for the setup and operation of Unity VR.

Device Selection

We chose to use the Oculus Rift for our project. Initially, we used the Oculus Quest, but during the first Unity test, we found that the Quest’s rendering speed was slow, the resolution was low, and there was significant lag that severely affected the gameplay experience. Because our project uses Unity shaders, rendering transfer speed is critical. Therefore, we resolved this issue by using Unity post-processing rendering and utilizing the low-latency head tracking and visual optimization capabilities of the Oculus Rift, which yielded better results.

         

Connecting the Headset:

To connect the Oculus Rift headset to Unity, I needed to ensure that the Unity and Oculus SDK versions matched. Then, I set up the Unity environment by enabling Oculus support in the XR Plugin Management, importing the Oculus Integration package, and setting up the OVRCameraRig. This required removing all other cameras in the scene to avoid conflicts that could prevent the display from working correctly.
Next, I added the OculusInteractionSampleRig to the scene and used the OVR Manager component in the OculusInteractionSampleRig > OVRCameraRig to adjust the Tracking Origin Type to Floor Level. By following these steps, we were able to successfully connect and use the Oculus Rift headset in Unity for our project.

Connecting VR Controllers:

To connect VR controllers in Unity, we needed to first ensure that the controllers were compatible with the Rift headset we were using.

Next, I mported the Oculus Integration package into Unity and added the OVRCameraRig to the scene. Then, i added the OVRInput component to the scene’s controllers to enable input functionality.

To map controller inputs to game actions, I used the Unity Input System, which allowed us to define custom input actions and map them to specific controller buttons. We then used these actions to control various elements of the VR experience, such as player movement and interaction with objects in the environment.

Sometimes, I encountered issues where only the headset was working, but the VR controllers were not responding. In the Oculus Store, it showed that the controllers were connected, but we could not control anything with them. I suspected that the controllers were not connected to Unity. To resolve this issue, I used OpenXR as a replacement and selected Oculus under Play Mode OpenXR Runtime. Then, in the Interaction Profiles, I clicked the “+” button to add the Rift Controller option, which enabled us to connect the controllers. Finally, I imported the XR Interaction Toolkit, which allowed me to use the controllers in our VR project.

At the beginning, the XR Interaction Toolkit was not running, and I discovered that it was due to an outdated version. However, the latest version was not displayed in the package list within Unity. To solve this, I selected the “+” button under the Package Manager and chose “Add Package by name.” Then, I entered “com.unity.xr.interaction.toolkit” and imported the latest version.

By following these steps, I was able to resolve the issue of the VR controllers not connecting in Unity and use them effectively in our project.

   

Grab Function:

To implement grabbing functionality in Unity VR, I use a prefab file that includes a ControllerGrabInteractor component and make it a child of the ControllerInteractors object.I add the Grab Interactor script to the controller object and use the HandGrabInteractor script for gesture tracking.

To make an object grabbable, I add the following necessary components: Collider, Rigidbody, Grabbable, and Grab Interactable. These components allow the object to have physical properties such as collision detection, mass, and gravity, and enable it to interact with the grab interactor script for grabbing and releasing.

reference:

https://circuitstream.com/blog/oculus-unity-setup

Leave a Reply

css.php

Report this page

To report inappropriate content on this page, please use the form below. Upon receiving your report, we will be in touch as per the Take Down Policy of the service.

Please note that personal data collected through this form is used and stored for the purposes of processing this report and communication with you.

If you are unable to report a concern about content via this form please contact the Service Owner.

Please enter an email address you wish to be contacted on. Please describe the unacceptable content in sufficient detail to allow us to locate it, and why you consider it to be unacceptable.
By submitting this report, you accept that it is accurate and that fraudulent or nuisance complaints may result in action by the University.

  Cancel