How do I access a HMD's Camera Actor's position and rotation so that I can utilize LineTrace?

Hi All,

I’m trying to create a VR experience using the Rift.

Here’s my issue: I’m trying to access the position of my HMD during gameplay so that I can create a LineTraceByChannel from it. Ultimately, I plan to use this LineTraceByChannel in order to determine what the player is looking at it.

However, the Camera Actor which I believe represents the position of my HMD only appears when I Play the scene. For this reason, I cannot make a reference to it in any of my blueprints.

I imported the First Person Character Blueprint into my scene in order to access its camera. After playing with the settings a bit, I got the Camera component of the First Person Character to shoot a line trace.

However, this camera is still separate from the Camera Actor the HMD seems to use when I play the scene.

How can I make the Camera the HMD utilizes and the camera that is part of the First Person Character the same thing?

Alternatively, how can I access the Camera Actor that represents my HMD when I run the scene? (It keeps disappearing when I stop the scene)

I’m not sure which template I started in, but I believe it was the default.

I have tried the following:

  • Locking the First Person Character’s Camera to the HMD.
  • Making the VR Marker component of the First Person Character the point from which the LineTrace is drawn.

Thanks,

Firstly you should probably upgrade your Unreal version since VR gets updates every time and there’s a VR starting world now.

Secondly I think you just need to create a player pawn blueprint with a camera in it and set it to “auto possess” player 0. Then you can just do whenever you want with the camera in that pawn.

Thirdly this youtube channel has a bunch of great tutorials.

No luck with any of the above. Did the first four four sections of’s VR Lab (the YouTube series above), followed what he did, and still had the same problem as before.

In the level blueprint, I drew a debug circle at the position of the camera. Even though the camera is locked to the HMD, the debug circle still stays in the original position of the pawn.

I can move around the room in the HMD and it will not update the camera’s position.

Any other solutions?

I’d highly recommend you looking into the new engine versions. There is a template where everything is set up the proper way. To get the camera rotation and location you can use this node: