How to get world location of HMD, all answers I find online don't give correct results.

I cannot for the life of me get an accurate location of the HMD. This is the BP I am using after a lot of googling and searching through here.


This does not work. It appears to be offset in front and above where the HMD actually is. Furthermore if I try to adjust statically to make up for this offset I discover the offset is dynamic and changes slightly as I move around. So I need a means of getting the HMD location correctly.

It depends on what you define as the HMD position, to my knowledge the position that the VR SDKs give you when you poll the HMD location is actually the position of the players eyes, or rather the center point in between your two eyes.
This means that to render the scene all you have to do is plus and minus half the players IPD (distance between their eyes) in a direction perpendicular with their forward facing direction and place two cameras there.

Again this I believe is how UE works, so when you poll the HMD location through the SDK by using the Rift function you use in the picture it actually gives you that mid point in-between the eyes. This is also the case when you get the cameras location by simply using the GetWorldLocation node on the component.

If you want the HMD location to be the center of the players head however you will need to offset for this fact, not at my computer but for the Rift I believe you can get access to that data through the SDK

Note as for the picture you linked that used to be what you needed to do to get the proper HMD location but since Epic introduced the Lock HMD functionality in the camera component (in 4.11) all you need to do is get the location of the camera

I understand what you are saying, buts it not the results I am getting.

When I try to get the HMD location (be it eyes or with an offset) I get an incorrect location. For example when testing I spawned a basic object at the HMD location, yet when I do this with the HMD on, the object is actually spawned above and in front of with about 2 meters of space between the HMD and the spawned object. If I then move around the playspace this 2 meter offset changes, and in no predictable way as far as I can tell.

Huh interesting, I would definitely check your collision then because it sounds like the object is colliding with something when it spawns

Edit: maybe try drawing a debug sphere every tick and see if that is in the appropriate position

I tried this and it still occurs, I honestly can’t understand what could be causing it.

Not really an answer, also this is about Vive, but maybe you can find useful something from this code (this is roomscale HMD-based character’s mesh movement):

Thank you! I shall try this and see how it goes.

I don’t believe that will help as it sets the HMD location to a constant 2 meters in the Z axis

anyway I forgot that I actually made a video on the matter a while back