World space position of UMG 3D widget in hierarcy

I’m trying to play sounds and display particle effects on exact positions of a 3D widget in a VR game, but I have not been able to find a reliable way of getting the world space position of the specific clicked widget.

The widget geometry tructure seems to be for the local space of the nested widget object itself, and not the entire widget system, and the absolute coordinates don’t seem to apply in any meaningful way in VR. I haven’t found any way of transforming these into a usable format.

Recording the hit position of the interaction component would be a viable option, except I want multiple hands with multiple interaction components to be able to use the UI at the same time, and there doesn’t seem to be any way of discriminating which one is using the widget.

I managed to get it working by walking up the widget hierarchy and adding the positions together. It requires doing it twice if the widget blueprint is nested inside another blueprint (like for a button in a menu).

I’m not sure about the performance impact of this though, or if it works in the general case. Any better solutions or suggestions are always welcome.

Blueprint code:

1 Like