NearFarInteractor's onSelectExited event doesn't know where the grabbed object was dropped

Hi, I’m facing the following problem:

Hands are grabbing an object and then placing it inside a socket. When the object is dropped, I’d like to know whether it was placed inside a socket, which one, or if it was dropped in open air.

The setup is the following: hands use NearFarInteractor → the object has XRGrabInteractable → the socket has XRSocketInteractable.

And the problem is that I can’t find a suitable event where I’d plug my handling logic (to know if the object was dropped in open air or in a socket).

I tried NearFarInteractor’s selectExited event, however in that event (in the arguments) I can see which object was dropped, but not whether the object was dropped inside a socket or in open air. It seems like at this point the engine still hasn’t processed that, the object is in .selected=false state and the socket’s selectEntered event gets trigged a bit later.

Is there some “proper”/elegant way of achieving this? Ideally I’d like to place this logic inside a single event, to make it easier to follow.

Thanks!

Hi @ltomov,
One way of accomplishing this during the selectExited event is to check if the XRGrabInteractable is hovered by any other Interactors (including XRSocketInteractor). There is a property called interactorsHovering, which has a list of everything currently hovering the interactable. If the list only contains the NearFarInteractor, you can assume it is in open air, otherwise you can check the type of the Interactors to find out if one of them is a socket and react accordingly.

Is this the information you were looking for?

Hi @VRDave_Unity ,

Yes, that did the trick!
The catch was that in selectExited, args.interactableObject is of type IXRSelectInteractable which has a more limited set of properties.
So I had to do args.interactableObject.transform.GetComponent< XRGrabInteractable >() which has a lot more stuff, including the interactorsHovering that shows the sockets.

Thanks a lot for the help!