How can I get screen coordinates of Slate/UMG/VirtualWindow widget rendered in World space?
Im trying to use Common UI, for decent gamepad support. One tricky issue is that only UMG added to Viewport works as expected. Im working on a VR game for the most part, so all my widgets are UWidgetComponents in various Actors placed in the world.
FCommonAnalogCursor does the gamepad highlighting by moving the cursor over the widgets, so they are in hovered state. That works correctly only when widget is added to the viewport, otherwise the coordinates are in VirtualWindow space that does not match the screen at all resulting in the cursors being in wrong spot.
How can I translate these coordinates to proper screen ones? Seems doable with Transform of the Actor that given widget is attached to, but I see no way to get it from FCommonAnalogCursor/Slate level. Any tips would be helpful!
The code in the cursor is something like this:
TargetGeometry = SWidget->GetTickSpaceGeometry();
const FVector2D AbsoluteWidgetCenter = TargetGeometry.GetAbsolutePositionAtCoordinates(FVector2D(0.5f, 0.5f)); // AbsoluteWidgetCenter is wrong here for World space widget SlateUser->SetCursorPosition(AbsoluteWidgetCenter);