Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

Tutorial 02 Basic Project

Will Kriski edited this page May 25, 2020 · 4 revisions

Creating a Basic Project

If everything in Tutorial 01 Setup was successful setting up your own project can be done with the following steps.

Step 1: Create a new project

First create a new project using the Godot Project Manager selecting OpenGL ES 2.0 as Renderer:

newproject

Step 2: Create your main scene

Create a 3D Scene as root node and save it GameMain.tscn:

mainscene

Step 3: Copy the Toolkit to your new Project Folder

You now need to copy the necessary files from your downloaded godot_oculus_quest_toolkit folder into your project. You need to copy the following three directories: addons, bin and OQ_Toolkit. Your folder structure should now look like this:

projectfolder

If you are curious what these folders contain here is a short explanation:

The addons folder contains the godot_oculus_mobile plugin which is necessary for godot to use the Quest as a VR device. It also contains the necessary function bindings to call the oculus mobile API from GDScript.

The bin folder contains a prebuild godot for android. This is your export template

The OQ_Toolkit folder contains all the scenes and scripts that make up the toolkit.

Step 4: Setup the global vr autoload

Got to Project->Project Settings in Godot and open the AutoLoad tab. Select the path OQ_Toolkit/vr_autoload.gd re-name it to vr on the right side and click add. It should look like this:

vrautoload

Click close to continue.

Step 5: Setup your Android Oculus Quest Export Settings

Got to Project->Export...; then click Add... and add a new Android preset. If you want you can rename it to Oculus Quest:

createexport

Now you need to adjust your export settings to allow for VR support on the oculus quest. Change to the following settings:

  • XR Mode --> Oculus Mobile VR
  • Degrees of Freedom --> 6DOF

Under Custom template - Debug select the godot apk from the bin folder you copied:

  • Debug --> bin/android_debug.apk

The result should look like this:

modifyexport

Now you are almost ready to go. You will just need to setup a minimal VR scene now.

Step 6: Create a minimal VR Scene

Navigate in the Godot FileSystem tab to the OQ_Toolkit, drag OQ_ARVROrigin.tscn onto your scene root node. Then drag OQ_ARVRCamera.tscn, OQ_LeftController.tscn and OQ_RightController.tscn onto your Origin. Make sure the scene tree looks like in the screenshot:

setuporigin

Step 7 Initialize VR from the main script

Next is to add the necessary initialization code as a script to your main scene: Right click on your root node (called Spatial in the scene) and select Attach script. Then click create and the script editor will open.

In the _ready() function you need to add the line vr.initialize() as displayed here in the screenshot:

addscript

Afterwards you can switch back to the 3d view with the 3d button at the top. If you get an error that the autoload vr could not be found don't worry this will resolve if you restart godot (assuming you set it up correctly in the previous step).

Now your scene should work already on the oculus quest. You can try to deploy it using the android icon on the top right.

When first launching your new project godot will ask for a main scene. Select your GameMain.tscn that you created.

You should see your two controllers and the sky in the background:

questroom

Step 8: Add some scene geometry to explore

To add some more interesting geometry to the scene you can use any 3d model that Godot can load. For example the .gltf format models from sketchfab.com usually work really well. For the example here I used https://sketchfab.com/3d-models/low-poly-room-blender-tutorial-6c6f589b7db14e8f8bbee6daac5e8213

Download the model in .gltf format, unzip it into your project folder and switch back to godot. Godot will import the .gltf file.

  1. Drag and drop the .gtlf file from the godot file explorer into your 3D viewport.
  2. You will need to reset the position to (0,0,0) so select the new scene node on the top left
  3. on the right in the inspector change the Translation to (0, 0, 0):

addscene

Done. You can now view the (slightly too small) scene directly in you headset. It should look like this:

questroom

If you want you can now adjust the scale of the room in the inspector to be closer to real world size by setting it to (2, 2, 2).

Have fun!