Help adding VR support to my game

Anyone have any suggestions for adding VR support to a PC game I’ve built in Blueprint?
My game is based on the third-person template but I made a true first-person camera, so VR would look fine.

I couldn’t find a way to add the VR template to my game (like how you can add the first-person or vehicle template), but used a workaround - I created a new VR template and migrated everything from my original project, not the best way I’m sure but it’s all I could figure out.

So my question is: is there an easy way to integrate VR into my base game? I would like the player to be able to choose VR or normal mode from the main menu, but the problem I’m having is that the VR Pawn has to be used in VR, and that breaks a lot of my code since it relies on the Third-Person Pawn.
It almost looks like I would have to release the game in two packages, one for regular PC and one for VR, but that sounds unnecessary.

I appreciate any suggestions!

making a vr proj and copying the other stuff over is the only way to get vr set right
if you add vr to a project it doesn’t come in with all the xr input mappings
if you start with the vr template then add to it all your inputs are already setup

Maybe look at a mechanic tutorial on how to switch between 3rd and first person.

1 Like

I’m not immediately aware of any/all ramifications of doing so, but if you make your VR pawn class a child of your third person pawn class, and all of your gameplay logic runs in that class, then you can (probably) quite happily get away with only adding the vr requirements in your vr pawn. I’m sure it won’t be that straight forward in honesty, but its probably adaptable. If not, then at worst you can have two separate classes and choose which one you want to spawn based on the mode you want.

There’s a few ways you can consider which character you would spawn then. The method I considered for a project that wanted the same kind of feature was using command line parameters to dictate and the gamemode would check and spawn the appropriate character class on postlogin

1 Like

Oh good to know, glad I did it right!

That makes sense, I wondered about a child class, I can give it a shot!

Yeah it shouldn’t be too hard to spawn the right pawn.

My Third-person pawn contains quite a few variables related to gameplay, a child class would probably fix that, but if that option dosen’t work well or breaks too many other things, is there a better place to store the variables that both the VR and Third-person pawns can access? Like maybe a custom PlayerController?

player state maybe?

Good idea, thanks!

This is a subject that interests me. I’ve abandoned a number of attempts to add VR to projects, giving up in frustration, wondering how on earth to marry 2 sets of pawns/characters. I don’t understand why there isn’t much written on this subject, or I just haven’t stumbled on it, or been able to find it. I understand now what you generally need to aim for at least, but being able to get it right is another matter! I have enough trouble understanding all the gamefiles with 1 pawn.

I too have been surprised by the lack of info/videos on this.
I’ve experimented a bit with the suggestions above, but haven’t completely solved it yet (I’ve got other projects I have to be working on as well). The parent/child idea is interesting, I wasn’t able to make it work perfectly, but again I haven’t had much time to really try to figure it out.
If I ever come up with a good solution, I plan to make a video tutorial on it!

This topic deserves a long running generalised subject and answer, tips etc, and pointers to tutorials etc. An Epic tutorial would be nice too!

I’m currently trying to get the Simplified Procedural Walk plugin working within VR.
I created a VR pawn BP as a child of the BP_Character_master ( main Simplified Procedural Walk blueprint).

This has now got 2 cameras in it, one is the SPW camera(says it is inherited from BP_char_master) and one is the VR camera.

I’d prefer to just delete the non VR camera but I can’t from a child BP. I’m also having a hard time trying to work out how to get a viewpoint from the VR camera. I.e. switching cams when there are 2 cams in a single BP, and one cam in flat screen, one in VR.

Oh, I also dragged into this blueprint a walker creature, if you know this plugin.

I also mapped controls for walking for my rift controllers.

When I start the game, the rift controllers respond, I can see my walker moving on the monitor. However, there is no in-VR headset-view of the game at all. It isn’t black, it has that gridded perspective view.

I’m mostly fiddling around in the dark just trying things, so any pointers, tips would be appreciated.

e.g Should I be making the VR pawn a child of the plugin pawn/character or vice versa? Which way seems more logical? Or neither way? A better way to merge them? Should I not have dropped the walker in the VR pawn BP? Way too many variables to stumble upon the correct answer. :frowning: