At line 394 in InteractionManager:
if (selectInteractor != null)
{
using (s_EvaluateValidSelectionsMarker.Auto())
InteractorSelectValidTargetsInternal(selectInteractor, m_ValidTargets, m_DeprecatedValidTargets);
}
if (hoverInteractor != null)
{
using (s_EvaluateValidHoversMarker.Auto())
InteractorHoverValidTargetsInternal(hoverInteractor, m_ValidTargets, m_DeprecatedValidTargets);
}
Why does the Select happen before the Hover? I’m trying to create a SelectFilter for the XRSocketInteractor to prevent it from “vacuuming” unselected interactables. I check in the HoverEntered callback, but by that time the socket has already selected loose interactable.
I honestly don’t know why it’s done in that order, but it has been that way since the very beginning over 6 years ago. It seemed risky to change it since it could cause subtle breakage in existing user code that relied on this order, so we just have never changed it to match up with how one would intuitively expect them to be ordered. I forgot to make that change to reverse the order when we bumped the major version to 3.0, so it likely won’t change until we bump major versions again which won’t be for a while.
In the meantime, you may need your custom filter class to implement both IXRSelectFilter
and IXRHoverFilter
to do the logic you want.
Are you trying to make it so the socket only selects an interactable object if it has been placed there while grabbing it with a hand and then letting go rather than selecting the object if it just falls into it? Are you using Hover Socket Snapping in this scenario or is that disabled?