Add API/Node for getting a UiShape and position from the player's interaction raycast
techanon
To improve UI interactivity, being able to know what the VRCUiShape and position of the player's pointer raycast is hitting via Udon would be extremely useful.
This will more easily enable things like custom animation handling, custom cursors, or non-standard interactions with the UI (eg: making a custom draggable 2D slider) without having to rely on magic numbers and special logic to deal with discrepancies between avatar sizes.
The first part is knowing which target it is, the second is the position. My thoughts are these two possible ways, whichever is the most sensible to implement:
if (uiShapeInstance.TryGetCursorPosition(out Vector3 position)) { }
if (VRCCursor.TryGetPosition(out VRCUiShape target, out Vector3 position)) { }
and the equivalent graph node, where the bool returned is false when the cursor is not detected on the respective UiShape(s).
Log In
BobyStar
I made a prefab a while back that estimates both hand lasers (or view ray on desktop, excluding TAB or touch) here but it's currently limited to U# usage for raycasting your own canvases or other colliders. It's also an estimate and not accurate so things can feel off.