Mouse and Keyboard Input in VR Template Project. (4.27)

Does anybody have any idea why COMMON gameplay inputs like WASD and spacebar do not work in any VR project? IS THIS A BUG?

To reproduce:

-Put the FPS blueprint pawn and add an event handler for “Any Key” and maybe tie it to a print node.

The following keys are bizarrely blocked: QWERASDF and SPACE.

I’m using OpenXR in UE4.27.

OK. I bashed my head in yesterday trying to fix this and finally found it out, just after posting here.

IT’S THE BP_VRSpectator! It’s consumes the input and therefore, does not pass it down to my pawn.

1 Like

I would never want to play a game with vr and mouse and keyboard.

It’s not for gameplay. During development, it’s extremely useful to get a third-person view of the VR pawn.

Also, VR headsets are not always available, and putting the headset on and off all the time can get quite bothersome.

1 Like

Hi, I have the same need, I would like to be able to use the mouse to turn the view when I’m in Play in Editor.
Were you able to do it?

Yes. In the VR template that comes with UE4.27 (maybe older versions too), there is a VR spectator pawn. Simply press Tab to activate it.

1 Like

Oh I see… thank you, unfortunately this is not what I’m looking for.
I need “look around” when I play in editor to test and debug, but I need to use Player Pawn, I wonder if it’s possible.

Everything is possible if you’re willing to code it. You might have to create your own pawn and edit the “Default Pawn Class” in GameMode to spawn it instead of the VR pawn. You can even get fancy and set it to None and then manually spawn either depending on whether you have an HMD connected.

1 Like

VRSpectator was added in 4.27. Previous versions doesn’t have it by default, but all of the functionality to build it exists.

1 Like

Actually I’m using a VRPawn on HMD and a FPSPawn in Editor, handled with 2 different Game Modes. It works but there are two main downsides:

  1. you have to switch GM Override to the right one before testing a level, and sometimes I forgot to set the right one passing to a different level… nothing serious, but the lost times accumulate.
  2. VR and FPS Pawns have almost same buleprints nodes, so each time I fix an error or modify something, I have to replicate it in the other as well… this way the risk of making oversights or errors is high, it is not the best to have duplicates.

This is why I’d prefer to have only one pawn working on HMD and in editor.

I’m experimenting with a solution for a mouse and keyboard “DebugPawn” that’s clean enough to be included in the template by default. It’s using Enhanced Input but earliest timeframe for this would be 5.1.


There’s also the Windows Mixed Reality Input simulator but I haven’t tried it with OpenXR: Using the Windows Mixed Reality simulator - Mixed Reality | Microsoft Docs

Glad to see it’s on the way! I’ll wait for it and in the meanwhile I suppose that I should get the work done with my temporary solution.
Thank You!

Hi, I heard that OpenXR is no longer beta and is production-ready, however, the ResetOrientationAndPosition() method is a dummy function and does nothing. I think this is a red alert and should be fixed immediately. Here’s the code in OpenXRHMD.cpp:

void FOpenXRHMD::ResetOrientation(float Yaw)

void FOpenXRHMD::ResetPosition()

I’m using Linux as much as possible so… :sweat_smile:

Is anybody found solution. I’m also want a solution for virtual reality template my project. I need to add keyboard input with my unreal game (5.0.3 version) .
It works when i connect quest 2 through vr preview. But after i packaged to quest 2 it does not work .

Thanks for advance

How did you get it to work in VR preview? I am doing my phd and comparing the effectiveness of VR vs desktop, so I have 2 levels in a third person game where in one ive changed the third person to a VR pawn, but when I try to move I cant. How do I fix this??