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
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 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.
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.
In the VR level I executed an “Enable HMD” node in Blueprints:
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.