Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Switch on VR mode in runtime

Hello, I have a problem with oculus DK2. I need to start my game in normal (LCD screen) mode with Occulus connected to the same PC. After some videos and intro presentation of application I need to switch to the VR mode and continue in that mode. Is possible to do this ? How ?

Thanks M.

Product Version: UE 4.8
more ▼

asked Jul 23 '15 at 01:07 PM in Blueprint Scripting

avatar image

16 2 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Here's a screenshot that will hopefully help. This is my blueprint that I call to change between VR and non-VR for the Rift and Vive. I also throw in a bunch of other console commands that optimize VR rendering (2nd screenshot).

It's also worth noting that (last time I tested) if you take off the Rift (which pauses the game) and then this blueprint is called, it won't switch back to non-vr mode until you put the Rift back on (unpausing the game). I wrote some custom code to deal with this in my engine, but there are probably better ways to deal with it. I've been using the Vive exclusively for a few months so I'm not sure if it's still an issue in 4.14

Also haven't tested on GearVR or GoogleVR since I don't have a use case for switching on those platforms yet.

alt text alt text

setupvr.jpg (70.9 kB)
setupvr2.jpg (161.8 kB)
more ▼

answered Dec 21 '16 at 06:53 PM

avatar image

Cameron Abt
111 3 7 18

avatar image bdogrular Jul 07 '17 at 11:11 AM

well, thank you very very much, i will try your solution and see if i can get it working.

Thank you

avatar image bdogrular Jul 07 '17 at 11:24 AM

Well , it was hard to understand because of the multi page split image but it worked exactly like you said.

But i am unable to move with keyboard and mouse.

avatar image Cameron Abt Jul 10 '17 at 10:04 PM

If you're in VR, you shouldn't be trying to move with the mouse and keyboard, that is unless you're trying to get yourself sick. However, if you still want to do it, you should make sure the character you're using in VR contains code to control the inputs and that the camera that's showing the stereo view is actually part of said character. Else the viewpoint will be static, even though your (invisible) character is actually moving throughout the level from your input.

PS I have a custom HMD setup with the vive that puts the mirror in fullscreen instead of just the middle part of the screen. I added the HMD mirror 4 command manually in the source, so you can safely ignore it.

avatar image bdogrular Jul 13 '17 at 11:40 AM

well the idea was to let people traverse the industrial scene without needing a vive/oculus set. So that i can do with having one build package that does both, in away, they are not meant to move in VR with KB.

I did not have time to research adding keys and movement to a blueprint so instead , i had two separa levels having same geometry but different gamemodes

avatar image Cameron Abt Jul 13 '17 at 04:15 PM

Ah, gotcha. Well let me share how I do that (since I do exactly the same thing). I use the VR game mode only (which uses our VR character as the default), and then I map some input to switch to the standard walking around character (for me I use F9 as a debug key, but also use an input from our menuing system to call the same code).

Overall it goes like this: Get input -> Spawn the new character of the correct class -> Possess that character with the player controller -> Destroy the VR character.

After that, you've got your brand new character, the world is the same, but now all input is handled by that character blueprint class and all that functionality is uncoupled from the VR class.

alt text

One other thing to note, is that if you just spawn the new character based on the transform of the VR character, it may or may not be in the correct position (could be trying to spawn through the floor with an incorrect roll or pitch. Experiment with those inputs to your transform to see what works for you).

new char.jpg (56.3 kB)
avatar image Cameron Abt Jul 13 '17 at 04:18 PM

Also, as an aside, the character I use for archviz is a derivation of the HAL Toolkit character on the marketplace which gives me some other cool utilities that I didn't have to create myself.


avatar image Muzaheed Aug 18 '17 at 11:04 AM

@Cameron Abt thanks for the instriuctions. It helped me to switch from vr mode to non-vr mode. but i cannot move from non-vr mode to vr mode.

Any idea?

after calling "Enable HMD" with the checked box i am executing this console cmd:

 Cmd: r.VSync  0
 Cmd: hmd  enable
 Cmd: STEREO on 
 Cmd: hmd mirror 1
 Cmd: r.SetRes 1920x1080f

avatar image Cameron Abt Aug 18 '17 at 03:24 PM

Try taking out the full screen set resolution command. I had issues early on where something like that would undo the stereo on command for some reason.

avatar image Muzaheed Aug 18 '17 at 10:01 PM

nope. no luck

avatar image Barane Chan May 17 '19 at 05:36 PM

Do we need to change the Output mode? Coz the VR resolution is different from the non-VR one? it seems to be crash on re-creating back buffer if not changing the output mode. If calling ChangeOutputMode, do you know where it is suitable place for it as it is a must calling on the rendering thread. I don't know where the suitable place in UE :( If anyone can help, that's much appreciated .

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

By default you should be able to use alt+enter to activate full screen mode which will also start rendering to any HMD you have plugged in. Any method going into full screen mode should do the trick as long as it's not windowed full screen. (It might still activate on windowed full screen but I'm pretty sure it doesn't.)

Since you have an intro presentation should I assume you want to start in full screen mode then switch over to HMD? If that's the case you can try to use the "Execute Console Command" blueprint node and give it the command "stereo on" or "stereo off". This way you don't have to also toggle full screen mode.

more ▼

answered Aug 07 '15 at 01:41 AM

avatar image

96 2 10 19

avatar image diamond3 Dec 21 '16 at 06:24 PM

does this work in Google VR and GearVR?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Quick, perhaps silly question: What integer do you get for clamping?

more ▼

answered Nov 09 '17 at 09:48 AM

avatar image


(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question