0 votes

I have a project that supports both VR (Oculus Quest 1) and desktop.

I currently set the android scene as the main scene, and run the desktop using the Play Scene F6 button with the desktop scene active.

I have read that it is possible to use a redirect scene whose main job is to get_tree().change_scene(url) . The question then becomes: how do I detect that the app is running on a VR headset in GDscript so I can switch to the environment-appropriate scene?

Godot version v3.2.stable.custom_build (Ubuntu)
in Engine by (36 points)

2 Answers

0 votes

I have the same problem with my port of BeepSaber to Godot4. The game tries to load a VR plugin if none is found, the VR Simulator is used as a fallback. But I do not have an Oculus Quest, instead I use a Valve Index with Monado and Libsurvive. So I also want to detect the type of VR runtime and HMD. So you might wan't to have a look at vr_autoload.gd.

by (18 points)
0 votes

Based on the code link from alexMunro I have the following kludge:

extends Spatial

func _ready():
    var interface = ARVRServer.find_interface("OVRMobile")
    if interface:
        get_tree().change_scene("res://scenes/AVR-exp1.tscn")
    else:
        get_tree().change_scene("res://scenes/exp2.tscn")

That is a script which is attached to the root (and only node) of my main scene.

I am including my code here in case his link ever gets 404-d. His code covered several other options for the argument to ARVRServer.find_interface() .

by (36 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.