using System; using System.Collections.Generic; using UnityEngine.Scripting.APIUpdating; using UnityEngine.XR.Interaction.Toolkit.Interactors; namespace UnityEngine.XR.Interaction.Toolkit.Interactables { /// /// An interface that represents an Interactable component that controls how a GameObject /// interacts with an Interactor component. An example is a Grab Interactable which /// can be picked up and moved by an Interactor. /// /// /// When scripting, you can typically write custom behaviors that derive from /// or one of its derived classes rather than implementing this interface directly. /// /// /// /// /// /// [MovedFrom("UnityEngine.XR.Interaction.Toolkit")] public interface IXRInteractable { /// /// Calls the methods in its invocation list when this Interactable is registered with an . /// /// /// The passed to each listener is only valid while the event is invoked, /// do not hold a reference to it. /// /// event Action registered; /// /// Calls the methods in its invocation list when this Interactable is unregistered from an . /// /// /// The passed to each listener is only valid while the event is invoked, /// do not hold a reference to it. /// /// event Action unregistered; /// /// (Read Only) Allows interaction with Interactors whose Interaction Layer Mask overlaps with any Layer in this Interaction Layer Mask. /// /// InteractionLayerMask interactionLayers { get; } /// /// (Read Only) Colliders to use for interaction with this Interactable. /// List colliders { get; } /// /// (Read Only) The associated with the Interactable. /// /// /// When this Interactable is a component, this property is the Transform of the GameObject the component is attached to. /// Transform transform { get; } /// /// Gets the that serves as the attachment point for a given Interactor. /// /// The specific Interactor as context to get the attachment point for. /// Returns the attachment point . /// /// /// This should typically return the Transform of a child GameObject or the itself. /// Transform GetAttachTransform(IXRInteractor interactor); /// /// The calls this method /// when this Interactable is registered with it. /// /// Event data containing the Interaction Manager that registered this Interactable. /// /// is only valid during this method call, do not hold a reference to it. /// /// void OnRegistered(InteractableRegisteredEventArgs args); /// /// The calls this method /// when this Interactable is unregistered from it. /// /// Event data containing the Interaction Manager that unregistered this Interactable. /// /// is only valid during this method call, do not hold a reference to it. /// /// void OnUnregistered(InteractableUnregisteredEventArgs args); /// /// The calls this method to update the Interactable. /// /// The update phase this is called during. /// /// Please see the and documentation for more /// details on update order. /// /// /// void ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase updatePhase); /// /// Calculates squared distance to an Interactor (based on colliders). /// /// Interactor to calculate distance against. /// Returns the minimum squared distance between the Interactor and this Interactable's colliders. float GetDistanceSqrToInteractor(IXRInteractor interactor); } }