Download

Adding widget to viewport results in it being rendered outside of either eye

I’m creating a simple VR game for Android and I have a kind of HUD widget which displays the score at set intervals when I have it do its animation to show and hide itself. In order to attach it, I do this in my character’s blueprint:

… and while it surely does add the blueprint to the viewport according to the placement constraints provided in the widget, it does it naively, ie. outside of either eye’s view but rather on top of everything, as if this was a flat game:

This of course makes it hardly readable and weird to look at when in headset. How do I make it render itself in VR, then?

Widgets don’t work in stereo as is. Use widget component.

What Yuri said. Widgets are composited as part of the nearly final phase and are put on top of any 3d views. This means it comes after the VR-correction etc. You need to instead attach a widget as a WidgetComponent to your VR Pawn typically and place it appropriately to be in the field of view.

@YuriNK @bsawler Hmm, but if I just place my widget as a widget component, I lose the easiness of placement control, right? Now I simply have it set up in my UMG to be 60 or so pixels from the upper right hand corner of the screen by using anchors. If I just add it as a component to one of the blueprints, I have to choose the specific placement, which IRL varies depending on the phone it’s played on, no?

Add the component as a child of the HMD camera. Then you can place it accordingly in the camera’s view and it will stay there as you look around, if that’s the desired effect. You’re placing it in world space not “pixel” / screen space in this case. However, yes it will vary depending on FOV of the screen.

So no way to make it stay in kind of the same place independently from resolution like in the widget view? Cause placing it with the world space in mind, how much of it shown will vary (possibly greatly) between devices as we get away from the reference aspect ratios.