How to obtain absolut location of HMD?

Hi there,

I am trying to do a line trace from the absolute position of the camera. But no matter what I do, the positional offset isn’t taken into account. This is my current setup:


The problem. When I move my head, the starting point of it seems fixed in space instead of moving with me. I also tried to add ‘get base rotation and base offset in meters’ but that doesn’t work also.

Does anyone see the error?

I’ll share with you how we have been doing it:


The “traceobject” is a custom event that I fire through a timer, the timer is better than a tick event as I have it set to fire every 0.1 a second, using tick events will fire 75 times a second (90 in CV1) which isn’t needed for something like object ray tracing, also many tick events will soon add up for performance. I also update the HMD world location at this same rate.

We also use capsule trace as the the single ray trace usually meant we had to be more precise with the looking direction where a 40 radius capsule worked well with our project requirements, you will need to find a radius that works for you.

The reason I have two capsule traces is that the top one will be used for object highlighting and the bottom one is used for interactions.

Hope that helps

Hi Chillybody,

many thanks for this very helpful answer! I will test this tomorrow as soon as I can!

Update: OMG, that really works. Finally, thanks to you, I have a valid world position of the HMD:


Many thanks also for the performance tips and the hint to use a capsule trace.

Seems I just suck at vector math. :wink:

EDIT: Extraced question to tracker camera in new thread:

Glad that helped, if I understand you correctly you are looking for a indicator for camera that sits on your monitor but in virtual space? If so you can use the following command, this will render the camera and the visible viewing angle assuming you are using UE4.8 and oculus runtime 0.6

hmddbg showcamera on/off/toggle

Just run this through a console command node and bind to a key.

Thank you, but a actually knew that. :slight_smile:
I need exactly this information as a transform in UE4. Want to build something like a wireframe which gets faded in if you come too close to the tracking frustum.

I thought you might, I thought I saw you mention it in another post, if I remember correctly the vr template by mitchmc had another way to draw the camera, I would probably have a look there

Hmm, I’ll take a look then into it, thank you.

EDIT: This doesn’t really work, also. Rotation isn’t re-applied to the tracker camera. Tried to rotate the position vector around getPlayerController–>getControlRotation but this doesn’t work either.