I feel like I’m going insane. I’ve sat at this for far too long now and just can’t seem to get my head around what exactly the HMD functions are doing.
What I need exactly: Because we all know that 2D UI is horrible that’s not what we are doing. The idea was to simply use a small spotlight instead. We have a closed off room (can’t disappear because there’s always surfaces where the light will be visible), the size stays the same to the player no matter the distance and it’s directly projected onto objects removing all issues a 2D crosshair would have. Sounds simple enough? Well that’s where the issues start.
How the hell do I place that spotlight? I can’t simply attach it to the camera because the camera doesn’t follow the position of the HMD. It does copy the control rotation so that part is no issue luckily.
But how do I get the location of the HMD? For testing I’m using BP. In theory it should be simple enough.
So first up. There’s nothing directly returning the world position. Alright no biggie. Let’s just “Get Positional Tracking Camera Parameters” which has a “Camera Origin in world space”. Nice. Get that, add your HMD device position and the result is hundreds of units off.
Let’s try to add that to my position and add the device position on top of that. Nope again.
Is it just a relative position? Nope. Still wrong. Subtract device position from camera origin and feed that into the relative position and it’s still wrong.
The funny thing is just as the original attempt, the relative one and some others in between did yield the correct result when I positioned the HMD absolutely 100% correct. Usually quite far back.
Any help is greatly appreciated.
In case that’s of any interest or someone can get more information out of it than I do.
My camera socket has the spawn location of:
X=566, Y=-744, Z=197
The camera origin is:
X=121, Y=12, Z=6
And the Device Position is:
X=68, Y=10, Z=-5
All values rounded to ints but that doesn’t really matter does it?
Is it really that hard to get the exact location of the player head? Or am I just overlooking something obvious?
Cheers and thanks for reading (and maybe helping? : )