Note:
This plugin is in alpha state.
Testing and resolution of remaining issues need to be complete before it's deemed stable and ready for use.
If you'd like to contribute to the testing process, follow the instructions below to setup and use the plugin,
and report any issues you encounter. Thanks!
This repository contains the source code for the Oculus Mobile Godot plugin. See demo project as an example for how to use the plugin.
This is an Android only plugin that is only supported on the following Oculus Mobile devices:
- Oculus Quest
- Oculus Go
The use of this plugin require Godot 3.2 or later.
- This project is released under a MIT license.
- Please check the Oculus Mobile SDK license for information about the Oculus Mobile SDK used in this project.
After cloning this repository make sure to initialise the submodules with git submodule init
.
When you've pulled a newer version make sure to run git submodule update
.
The project uses cmake
as its primary build system, which you can configure by following the setup instructions
for the Android SDK & NDK.
- Download and setup the Android SDK.
- If using Android Studio, download version 3.4 or higher.
- If using the command line tools, download revision 26.1.1 or higher.
- To ensure you have the latest version, check SDK Manager for updates.
- Add the Android SDK cmake binaries directory to the environment path. The directory can be found under
<android_sdk_location>/cmake/<cmake_version>/bin
.- Ensure that
cmake_version
is greater or equal to version3.6.0
.
- Ensure that
- Download and setup the latest version (version r20 or higher) of the Android NDK.
- Set the environment variable
ANDROID_NDK_HOME
to the Android NDK location.
By default the project is configured to checkout the godot_headers
repo as a submodule under the godot_headers
directory when you run
the git submodule init
and git submodule update
commands.
You can edit the GODOT_HEADERS_DIR
cmake variable in the CMakeLists.txt
build file if you'd like to provide a different source for the Godot headers.
- Download the latest version
(version 1.24.0 or higher) of the Oculus Mobile
SDK into a sub-directory of the
ovr_sdk_mobile
directory. It's recommended to use the SDK version as the sub-directory name (e.g:ovr_sdk_mobile/1.24.0/
for version 1.24.0 of the Oculus Mobile SDK). - Update the
OVR_ROOT_DIR
cmake variable in the theCMakeLists.txt
build file to point to the Oculus Mobile SDK root directory.
Note: Ensure you're using the Android SDK's version of cmake
.
In the project root directory:
- Navigate to the
build
directory:cd build
- Run:
cmake -GNinja ..
cmake --build .
Once the build successfully completes, the plugin and its dependencies shared libraries can be found in the
default output location: demo/addons/godot_ovrmobile/libs/<arch>
When exporting the project apk in Godot, the following Android export
Graphics
options should be set:
Xr Mode
must be set toOculus Mobile VR
.Degrees of Freedom
:- If deploying only on Oculus Quest, this must be set to
6DOF
- If deploying on Oculus Go, or on Oculus Go and Oculus Quest,
this must be set to
3DOF and 6DOF
- If deploying only on Oculus Quest, this must be set to
This plugin exposes parts of the Oculus VrApi via GDNative script classes. The actual exported functions can be found in src/config/.
Here is an example of how to use these classes inside GDScript:
onready var ovrTrackingTransform = preload("res://addons/godot_ovrmobile/OvrTrackingTransform.gdns").new()
onready var ovrGuardianSystem = preload("res://addons/godot_ovrmobile/OvrGuardianSystem.gdns").new()
func _process(delta):
print("GetTrackingSpace: " , ovrTrackingTransform.get_tracking_space())
print("GetBoundaryVisible: ", ovrGuardianSystem.get_boundary_visible())
print("GetBoundaryOrientedBoundingBox: ", ovrGuardianSystem.get_boundary_oriented_bounding_box())