XR Interaction Toolkit

I’m a bit lost as to how to work with the XR interaction Toolkit.
I watched the tutorial series https://www.youtube.com/playlist?list=PLQMQNmwN3Fvx2d7uNxMkVOs1aUV-vxrlf

I get how to apply these to objects and get functionality with the base system. What I’m not really understanding is how these are really communicating with each other to get that functionality.

For example, the XRGrabInteractable has an override void ProcessInteractable, but how is this actually getting called to action from something like the XRController?

What I’m looking to do is use the XRGrabInteractable for AR and grab objects like you would with a standard VR setup. From what I understand, this class is really meant to be used for XR with controllers so I’m looking to convert it for touch interactions.

This question kind of stems from two areas,

One, how are these classes interacting with one another? Another example (Specifically for AR)

Looking in the ARSelectionInteractable class we have:

   /// <summary>This method is called by the interaction manager
        /// when the interactor first initiates selection of an interactable.</summary>
        /// <param name="interactor">Interactor that is initiating the selection.</param>
        protected internal override void OnSelectEnter(XRBaseInteractor interactor)
        {
            base.OnSelectEnter(interactor);
           
            if (m_SelectionVisualization != null)
                m_SelectionVisualization.SetActive(true);
        }

From what I gather, the class ARGestureInteractor under namespace UnityEngine.XR.Interaction.Toolkit.AR is firing off an event or something in that line to signify that a touch interaction has been made. Example of the code is as follows

   /// <summary>
        /// Gets the Tap gesture recognizer.
        /// </summary>
        public TapGestureRecognizer TapGestureRecognizer
        {
            get
            {
                return m_TapGestureRecognizer;
            }
        }

The second par of this question revolves around me not really understanding certain things about programming, are there any Unity tutorials or tutorials in general people recommend that would help me in understanding this area of programming as I find myself getting a bit lost in understanding of how to work with the majority of the XR interaction Toolkit.I think most of this comes from the this event type system / get and set, and how you’re supposed to override specific classes to create extensions to these. I’m not really sure where my real gaps are as I don’t know what I don’t know. But the XR interaction Toolkit seems to definitely hit that sweet spot of the areas I’ve been struggling in.

Hi there, I’ll do my best to fill in the gaps for you.

For example, the XRGrabInteractable has an override void ProcessInteractable, but how is this actually getting called to action from something like the XRController?

You may have noticed that when you add XR Interaction Toolkit scripts to a scene, you also get a XRInteractionManager. Interactions are handled by the XRInteractionManager. This is a centralized place that all ProcessInteractor() and ProcessInteractable() functions are handled. All interactors and interactables register with their XRInteractionManager. This is handled in the base classes XRBaseInteractable and XRBaseInteractor, from which all of our examples inherit.

In XRInteractionManager, first all of the ProcessInteractor functions are run. Interactors look for targets and try to activate them. Second, ProcessInteractable functions are run. This is where interactables react to being activated.

To understand the pieces you are fitting together, look at XRInteractionManager and the base classes for example interactors and interactables. If “base class” and “inheritance” are new concepts for you, try looking for tutorials for those concepts or “object-oriented” programming.