This repository has been developed as part of the project "Mixed Reality Environment For Harvesting Study" done by Alessandro Dalbesio.
This repository contains all the code relative to the Virtual Environment.
The development has been done for the Oculus Quest 2 but it should be compatible with other Oculus devices.
To install this Unity project follow these steps:
- Clone the repository
- Open Unity Hub
- Click on "Add" and select the cloned repository
- Open the project
- Import from Asset store the package "Oculus Integration"
- Go to File > Build Settings
- Go to "Android" and click on "Switch Platform"
- If in the bottom right of the unity windows the Oculus icon has some dot on it click on it and then click to "Apply all"
- Modify the parameters in the file
Scripts/Parameters.cs
according to your needs. At the moment the synchronization of the parameters is not automatic as in the case of the other components of the system.
Note: The Oculus Integration is very helpfull to manage the Oculus Quest (It's possible to use the Oculus Quest without it but it's much simpler to use it).
If you see lots of warnings in the console, don't worry, they are all related to the Oculus Integration and they don't affect the project.
Folow these steps to be able to run the project onto the Oculus Quest:
- Connect the Oculus Quest to the computer with the link cable
- If you have any VPN active, disable it (ZeroTier doesn't give any problem but other VPNs do)
- Open the project in Unity
- Go to File > Build Settings > Platform: Android
- If the Oculus Quest has been correctly connected to the computer and the access permissions has been done from the Headset you should be able to see the device in the section "Run Device"
- [Optional] If you wish to see the logs from the Headset you should click on the button "Development Build"
- Click on "Build and Run"
- [Optional] If you have clicked on the button "Development Build" you can now go in the "Console" window and click on "Editors" and then on "Oculus". All the logs from the Headset will be shown in the console.
Here a overview over the main folders is given. Below you will find a more detailed description on the files of the Scripts
folder.
The main folders of the project are:
Materials
: this folder contains all the materials used in the projectPrefabs
: this folder contains all the prefabs used in the project.OBJImport
: this is a third party library used to import .obj files into Unity. It's not well documented but it's very easy to use and to modify (you just need to spend a little bit of time).Scenes
: this folder contains all the scenes of the project.Scripts
: this folder contains all the scripts of the project. The other folders are generated automatically from Unity and so a deep description is not given.
Below you can find a structure of the code in the folder Scripts
OptitrackObjects/Rigidbody.cs
: This file contains the class Rigidbody that is used to store all the information relative to a rigidbody from the Optitrack server.OptitrackObjects/Tracker.cs
: This file contains the class Tracker that is used to store all the information relative to a tracker from the Optitrack server.DataSynchronizer.cs
: This file manage the synchronization of the data between the server and the client.Model.cs
: This file contains the class Model that is used to store all the information relative to a model.Parameters.cs
: This file contains some settings related to the parameters of the project.SceneLoader.cs
: This file contains all the methods needed to load the scenes.StorageManager.cs
: This file contains all the function to store and retrieve the data from the storage. This file might also be used to implement a database (but it's not implemented yet because I had problems compatibility issues between SQLite and the Oculus).Texture
: This file contains the class Texture that is used to store all the information relative to a texture.TrackerSynchronizer.cs
: This file manage the synchronization of tracker data from the Optitrack (through the websocket server) to the client.
Here a list of the things that still need to be done (in order from the most important):
- Do a calibration system to be sure that the virtual environment is aligned with the real one
- Create the scene from the trackers
- Add a reconnection system if the connection to the server is lost
- Synchronize the options in the Virtual Environment automatically with the server (as the user interface does)
- Synchronize the options in the Virtual Environment automatically with the Optitrack Bridge (IDs and names)
- Manage the situation in which a user has disconnected from the user interface but the virtual environment is still running
- Add the possibility of selecting the model and texture also from the Oculus Quest
The two main files that should be modified are
TrackerSynchronizer.cs
andSceneLoader.cs
.
The following versions have been used:
- Unity 2021.3.19f1
- Oculus Integration 54.0
This repository is part of the project "Mixed Reality Environment For Harvesting Study" done by Alessandro Dalbesio.
The project has been done in the CREATE LAB (EPFL).
Professor: Josie Hughes
Supervisor: Ilic Stefan
This project is under MIT license.