Toggle VR/PC mode

How would I go about to toggle VR/PC mode in a single application?
I’ve tried running ExecuteConsolecommand(stereo on/off) but that wasn’t enough.

I also thought changing the pawn might be sufficient as shown in the Figure below.
So my question is, how can I do this? I need a multiplayer application where both VR and non-VR users can interact with one another

1 Like

I’ve updated the code a bit, but it’s still failing.

Amazing, I’m going to give it a try and I’ll get back to you. Regardless of what, I am very happy of your response. thanks for taking your time. Hopefully it works ;D

I wanted that functionality as well and I figured one way to do it. I recreated Epic’s Multiplayer Tutorial (Link to playlist: Blueprint Multiplayer: Project Overview | 01 | v4.11 Tutorial Series | Unreal Engine - YouTube which I will not explain in detail) and added my modified HMDLocomotionPawn to it. Inside of my Lobby I have the “Lobby Game Mode”(LobbyGM) and the “Lobby Player Controller”(LobbyPC).

There is a node called “Enable HMD” which sets a boolean for (de-)activating your HMD. I used that node and just respawned the player with the “Respawn Player” event inside of the LobbyGM. Inside of the “Respawn Player” I just added a branch to decide if I want to respawn as a VR Player or as a non-VR Player.

This is the first time I did a response on answerhub and hopefully this was useful to you :wink: My workaround at least worked for me and I could respawn as a third-person character or as a FPS character.

Yea I had some issues but finally got past most of them. But now for some reason when I call “Enable HMD”, it returns false. I.e., it fails to enable the HMD. Any idea why? My HTC Vive is connected and fully functional.

Edit:
I just noticed on the documentation, “Enable HMD” Is in the Oculus Library, is it possible it only works for the Oculus and not the HTC Vive?

So, I used the response from VizualTek to create my own solution as his answer didn’t fully work for me, although credits to you VizualTek! It helped me, so thank you!
In case anyone else having this problem, here’s a thorough answer.

]

Here’s the main event, I bind it to the ‘§’ key event.

I have a flipflop to toggle VR enabled/disabled. The collapsed nodes “EnableHMD” calls stereo commands “Stereo on”, “HMD enabled” and “HMD sp 90” (sp is screenpercentage I believe, higher means better quality but more demanding).

This destroys and unpossesses the currently possessed pawn with reference to a player controller.

This spawns and possesses a new pawn. Note you need to use a pawn CLASS not reference. If you use a variable, don’t forget to set the value to it, I accidentally just set the datatype first (lol) ;D

The collapsed nodes “DisableHMD” does “Stereo off” and “HMD disabled”.

Finally, test it by package the program. It doesn’t fully work in the Editor.

Yeah, I should have mentioned, that I use the Oculus Rift for this. So this is totally possible. I didn’t work with the Vive yet, so I assumed that this might help as well, but if it’s part of the Oculus Library, then that is no universal approach.

Yea I believe that’s the case. Either way as you’ve probably seen I resolved the isssue and I had help from your answer. I also watched through the YouTube series you referred to and used some of it as a reference to rebuild my networking for the better ;D

I must add this, I tested the “Enable HMD” BP function again and now it works.
So I don’t know what was failing previously. So I guess it’s very possible to use the “Enable HMD” BP function as mentioned by VizualTek.

@Vizualtek: maybe you could share an (almost blank) UE project that has this functionality already set up? That would help all Oculus users bigtime!

Does someone know if on 4.18 and after you can disable STEREO but keep HMD camera controls???

Bom dia amigo.

Estou tentando fazer um projeto que execute em uma maquina em vr e em rede o outro pc execute em modo normal.

poderia me passar seu projeto para verificar o codigo.

marciosalvaya@gmail.com

For everyone that might still have problems:
I wanted to switch between VR and PC between different levels. I just load the corresponding levels in a “Play this level in VR” session and execute a “vr.bEnableStereo 0” in the Begin Play event in the level which is meant for Desktop use.

350376-zwischenablage01.png

In the VR level I executed an “Enable HMD” node in Blueprints:

350378-zwischenablage01.png

This specifically allowed me to use a Slate/UMG menu in the one level while having a normal scene in the other one.

I have been working on the runtime VR/PC mode switch for a while. I am using Mixed Reality devices and OpenXR. The PC to VR mode works just fine with the console command of vr.bEnableStereo 1. But VR to PC always ends up quitting the game. Really frustrating.

We did some work on this for 5.1, can you reproduce it there?

any resolution? VR to PC in 4.27 using OpenXR still crash

The issue has been solved in 5.1.1, so if this is important to you I suggest you update. We’re not pushing hotfixes older engine versions.

Hi,VictorLerp.

Is it possible to view the reason or source of the solution on any page? I really want to develop with 4.27.