Code Monkey home page Code Monkey logo

Comments (5)

BastiaanOlij avatar BastiaanOlij commented on July 26, 2024

Sorry for the very very late reply.

The viewport not returning to a normal viewport after ARVR is turned off sounds like an issue in Godot itself, it is supposed to adjust the size and everything automatically.

What do you mean by uninitialising and re-initialising? If you uninitialise the interface that shuts down openvr completely and is very wasteful. Or do you simply mean switching which viewport is set as the ARVR viewport?

You can't have more then one viewport set as the ARVR viewport at any given time so if removing the ARVR status on a viewport is causing issues that might result in problems.

from godot_openvr.

kb173 avatar kb173 commented on July 26, 2024

No worries!

Make sense - I'll report the viewport size issue to Godot.

I can see how it's wasteful, but I think it might still be sensible in our case: Our program is usually controlled traditionally with mouse and keyboard, VR is only turned on sometimes to view the landscape from VR. It's plausible to have long times between that where VR is turned off, so that's where we'd want to uninitialize the interface. Or should we leave the interface initialized and only remove all VR nodes and ARVR viewports?

If I recall correctly, uninitializing and initializing could actually drop the FPS permanently, and there was also the crash mentioned above that happened sometimes when calling uninitialize. Would a small example project be of use, or is uninitializing not really something we should do anyways?

from godot_openvr.

milmarg avatar milmarg commented on July 26, 2024

Hi. have you found any solutions? I'm having same issue. After switching arvr to false image gets distorted/stretched... :(

from godot_openvr.

kb173 avatar kb173 commented on July 26, 2024

@milmarg Unfortunately not... also, it seems like OpenXR in Godot 4.0 assumes even more strongly that VR is either consistently enabled since startup or consistently disabled (see https://docs.godotengine.org/en/latest/tutorials/xr/setting_up_xr.html#openxr). So it seems like the only workaround is to make a full restart for enabling/disabling VR as painless as possible (this is what we ended up doing).

from godot_openvr.

AlnisS avatar AlnisS commented on July 26, 2024

I found a workaround: bumping the viewport's size around seems to fix it (desktop Windows, Android native, web). Running 3.5.1.

Here is my full exit vr method (verified working in 3.5.3 also):

func exit_vr():
	var interface = ARVRServer.find_interface("Native mobile")
	interface.uninitialize()
	get_viewport().arvr = false
	$"%Camera".current = true

	# hack to get 2D viewport to return to normal...
	var vs = get_viewport().size  # get the actual size
	get_viewport().size = vs - Vector2.ONE  # bump it (make something refresh?)
	get_viewport().size = vs  # restore it to the actual value
	
	vr_active = false

from godot_openvr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.