HUD crosshair distance from camera using HMD

You have a Billboard component that you can use to draw your crosshair.

Hi there,
I’m actually working on a VR version of a first person project initially created in 4.10.
I’ve got an Oculus DK2 connected, and I develop the project under 4.11.2.

In 4.10 I used a FirstPersonHUD to draw a texture as a crosshair in center of the screen.
Since I use VR, I saw on many forums that I’d have to use it differently, since the HUD draws on the screen, not in world space.
However it looks like using the standard HUD with HMD works pretty fine, with the crosshair showing up at round 1,5m from camera.
Does anybody use it the same way ? Is there a way to check/modify the distance between the crosshair and the camera ?
For now I’ve the HUD with a “draw texture” node, in screen space, and UE changes the thing itself to work with VR.

On the other side I’ve set up a linetrace from the FirstPersonCharacter to draw a crosshair at a proportionnal distance from what I’m looking at (hope I’m clear enough, don’t worry to ask if not). But how to draw a texture/billboard there ? Drawing a debug point works well, but I can’t find a node to draw something else.

Thanks a lot !

Yep, I found that, am working on it but can’t reach a good result for now.

You could just use a “magic number” : find the best distance where the billboard scale is 1 and just do : scale = distanceCamera_LookAtPoint / bestDistance.
If your best distance is 1m and your distance between the camera and the point you are looking at is 2m, the scale should be 2.
That should work, no ?

Ok the billboard is drawn well, but I can’t scale it proportionally from the distance it is seen.

Ok there is an issue refreshing the “set scale” of a billboard element but it works with some adjustments.
Thanks !

Yep, it should. However setting the screen scale of the billboard works great too :slight_smile:

Ah okay. I was not sure if it worked in a VR context but glad to read that :slight_smile: