### Manual XR Interaction Toolkit Installation (JSON) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/manual/installation This snippet shows how to manually add the XR Interaction Toolkit package to a Unity project by modifying the `manifest.json` file. It's used when direct installation through the Package Manager is not possible or desired. Ensure the JSON structure remains valid after adding the dependency. ```json "com.unity.xr.interaction.toolkit": "3.3.0-pre.1" ``` -------------------------------- ### Set Starting Select Filters List (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit Defines the initial list of select filters that populate the `selectFilters` list at startup. Objects in this list must implement `IXRSelectFilter`. ```csharp public List startingSelectFilters { get; set; } ``` -------------------------------- ### Setup XR Interaction Manager Source: https://context7.com/context7/unity3d_packages_com_unity_xr_interaction_toolkit_3_3/llms.txt Demonstrates how to access and register components with the XR Interaction Manager programmatically in Unity. It shows how to find an existing manager and add new interactors at runtime. Requires the UnityEngine.XR.Interaction.Toolkit namespace. ```csharp using UnityEngine; using UnityEngine.XR.Interaction.Toolkit; public class InteractionManagerExample : MonoBehaviour { void Start() { // The Interaction Manager is typically added to the scene via the GameObject menu // (GameObject > XR > Interaction Manager) and registered automatically. // Access the active manager programmatically: var manager = FindFirstObjectByType(); if (manager != null) { Debug.Log($"Found Interaction Manager with {manager.interactors.Count} interactors"); Debug.Log($"Registered interactables: {manager.interactables.Count}"); } // You can also create and register components at runtime: var newInteractor = gameObject.AddComponent(); manager.RegisterInteractor(newInteractor as IXRInteractor); } } ``` -------------------------------- ### Automatic Namespace Update Example (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/manual/upgrade-guide-3 Demonstrates how the Unity editor might automatically update namespaces when migrating to XRI 3.0. It shows the conversion from a shorter to a fully qualified namespace path, which can lead to lengthy code. ```csharp XRBaseInteractable m_Interactable; ``` ```csharp UnityEngine.XR.Interaction.Toolkit.Interactables.XRBaseInteractable m_Interactable; ``` -------------------------------- ### Unity C# Climbing System Setup Source: https://context7.com/context7/unity3d_packages_com_unity_xr_interaction_toolkit_3_3/llms.txt Sets up the climbing system by adding a ClimbProvider to the XR Origin and creating a climbable wall interactable. It configures climb assistance settings and defines the properties of the climbable wall, including its transform and interaction layer. ```csharp using UnityEngine; using UnityEngine.XR.Interaction.Toolkit; using UnityEngine.XR.Interaction.Toolkit.Locomotion.Climbing; public class ClimbingSystemSetup : MonoBehaviour { void Start() { // Add Climb Provider to XR Origin var climbProvider = gameObject.AddComponent(); // Configure climb assistance climbProvider.climbAssistSpeedMultiplier = 1.5f; // Create a climbable wall CreateClimbableWall(); Debug.Log("Climbing system configured"); } void CreateClimbableWall() { // Create a wall object var wallObj = GameObject.CreatePrimitive(PrimitiveType.Cube); wallObj.name = "Climbable Wall"; wallObj.transform.position = new Vector3(0, 2.5f, 5); wallObj.transform.localScale = new Vector3(5, 5, 0.5f); // Add climb interactable var climbInteractable = wallObj.AddComponent(); climbInteractable.climbProvider = GetComponent(); climbInteractable.interactionLayerMask = InteractionLayerMask.GetMask("Default"); // Configure climb settings climbInteractable.allowFreeXMovement = true; climbInteractable.allowFreeYMovement = true; climbInteractable.allowFreeZMovement = false; Debug.Log("Climbable wall created"); } } ``` -------------------------------- ### Manage Locomotion Starting State in Unity C# Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Movement This C# method is overridden to manage the transition when locomotion enters the 'Moving' state. It is called after the provider gains access to the XRBodyTransformer and before invoking locomotionStarted. ```csharp protected override void OnLocomotionStarting() { // Method implementation details here } ``` -------------------------------- ### Set Starting Hover Filters List (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit Defines the initial list of hover filters that populate the `hoverFilters` list at startup. Objects in this list must implement `IXRHoverFilter`. ```csharp public List startingHoverFilters { get; set; } ``` -------------------------------- ### Setup Continuous Movement Provider in Unity C# Source: https://context7.com/context7/unity3d_packages_com_unity_xr_interaction_toolkit_3_3/llms.txt This C# script demonstrates how to programmatically add and configure the `ContinuousMoveProvider` component in Unity. It sets movement speed, strafing, gravity settings, and input sources for XR controllers. This script requires `UnityEngine.XR.Interaction.Toolkit` and `UnityEngine.InputSystem` namespaces. ```csharp using UnityEngine; using UnityEngine.XR.Interaction.Toolkit; using UnityEngine.XR.Interaction.Toolkit.Locomotion.Movement; using UnityEngine.InputSystem; public class ContinuousMovementSetup : MonoBehaviour { [SerializeField] private InputActionReference leftHandMoveAction; [SerializeField] private InputActionReference rightHandMoveAction; [SerializeField] private Transform forwardSource; // Usually the camera/head void Start() { // Add Continuous Move Provider to XR Origin var moveProvider = gameObject.AddComponent(); // Configure movement speed moveProvider.moveSpeed = 3f; moveProvider.enableStrafe = true; // Configure gravity and flying moveProvider.useGravity = true; moveProvider.gravityApplicationMode = ContinuousMoveProvider.GravityApplicationMode.Immediately; moveProvider.gravityMode = ContinuousMoveProvider.GravityMode.UseGravity; // Configure forward source (direction of movement) moveProvider.forwardSource = forwardSource; // Configure input moveProvider.leftHandMoveInput = new UnityEngine.XR.Interaction.Toolkit.Inputs.Readers.XRInputValueReader { name = "Left Hand Move" }; moveProvider.rightHandMoveInput = new UnityEngine.XR.Interaction.Toolkit.Inputs.Readers.XRInputValueReader { name = "Right Hand Move" }; Debug.Log("Continuous movement provider configured"); } } ``` -------------------------------- ### HoverEnter Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit Initiates the process of starting a hover interaction between an Interactor and an Interactable. ```APIDOC ## HoverEnter(IXRHoverInteractor interactor, IXRHoverInteractable interactable) ### Description Initiates hovering of an Interactable by an Interactor. This method first checks whether the interactor and interactable are registered and are in a state where it could hover. This is a virtual method. ### Method POST (Conceptual - this is a method call within Unity) ### Endpoint N/A (Method within a Unity component) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp IXRHoverInteractor enteringInteractor = ...; IXRHoverInteractable enteredInteractable = ...; interactionManager.HoverEnter(enteringInteractor, enteredInteractable); ``` ### Response #### Success Response (200) No explicit return value, but the hover state is updated. #### Response Example ```csharp // Hover state is updated internally. ``` ``` ```APIDOC ## HoverEnter(IXRHoverInteractor interactor, IXRHoverInteractable interactable, HoverEnterEventArgs args) ### Description Initiates hovering of an Interactable by an Interactor, passing the given `args`. This method is protected and virtual. ### Method POST (Conceptual - this is a method call within Unity) ### Endpoint N/A (Method within a Unity component) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp IXRHoverInteractor enteringInteractor = ...; IXRHoverInteractable enteredInteractable = ...; HoverEnterEventArgs hoverArgs = ...; interactionManager.HoverEnter(enteringInteractor, enteredInteractable, hoverArgs); ``` ### Response #### Success Response (200) No explicit return value, but the hover state is updated. #### Response Example ```csharp // Hover state is updated internally with provided arguments. ``` ``` -------------------------------- ### Unity MonoBehaviour Lifecycle Methods (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Gaze Standard Unity MonoBehaviour lifecycle methods used for initialization, updates, and managing component state. These include Start, LateUpdate, Update, OnEnable, and OnDisable. ```csharp protected void LateUpdate() protected void OnDisable() protected void OnEnable() protected void Start() protected void Update() ``` -------------------------------- ### Configure Starting Grab Transformers (Unity C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Interactables Defines lists of XR grab transformers that are automatically linked when an interactable is selected. 'startingMultipleGrabTransformers' is used when multiple interactors select the object, while 'startingSingleGrabTransformers' is for a single interactor. Modifications after startup should use Add/Remove methods. ```csharp public List startingMultipleGrabTransformers { get; set; } public List startingSingleGrabTransformers { get; set; } ``` -------------------------------- ### Setup Lazy Follow UI Component in Unity C# Source: https://context7.com/context7/unity3d_packages_com_unity_xr_interaction_toolkit_3_3/llms.txt This C# script demonstrates how to set up the Lazy Follow UI component in Unity. It configures position, rotation, and depth following parameters for a UI element, typically attached to the player's camera or head transform. Dependencies include the UnityEngine and UnityEngine.XR.Interaction.Toolkit.UI namespaces. ```csharp using UnityEngine; using UnityEngine.XR.Interaction.Toolkit.UI; public class LazyFollowUISetup : MonoBehaviour { [SerializeField] private Transform playerHead; void Start() { // Add Lazy Follow to UI canvas var lazyFollow = gameObject.AddComponent(); // Set target to follow (usually player's head/camera) lazyFollow.target = playerHead; // Configure position following lazyFollow.positionFollowMode = LazyFollow.PositionFollowMode.Follow; lazyFollow.movementSpeed = 5f; lazyFollow.movementThreshold = 0.5f; // Distance before UI starts following lazyFollow.snapDistance = 3f; // Distance for instant snap // Configure rotation following lazyFollow.rotationFollowMode = LazyFollow.RotationFollowMode.LookAtWithWorldUp; lazyFollow.rotationSpeed = 8f; lazyFollow.angleThreshold = 30f; // Angle before UI starts rotating lazyFollow.snapAngle = 90f; // Angle for instant snap // Configure depth adjustment lazyFollow.depth = 2f; // Distance in front of target Debug.Log("Lazy Follow UI configured"); } } ``` -------------------------------- ### OnEnable Method in C# Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Feedback Unity's MonoBehaviour lifecycle method, called when the object becomes enabled. Often used for setup. Declared as protected void. ```csharp protected void OnEnable() ``` -------------------------------- ### Configure Tracked Pose Driver for Motion Controller (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/manual/create-basic-scene This C# code demonstrates how to configure a Tracked Pose Driver (Input System) component to update a motion controller's Transform component with position, rotation, and tracking state. It specifies the input binding paths for the left controller. ```csharp using UnityEngine; using UnityEngine.InputSystem; public class XRControllerSetup : MonoBehaviour { public TrackedPoseDriver leftControllerDriver; void Start() { if (leftControllerDriver != null) { // Configure Position Input for the left controller leftControllerDriver.positionInput = "{LeftHand}/devicePosition"; // Configure Rotation Input for the left controller leftControllerDriver.rotationInput = "{LeftHand}/deviceRotation"; // Configure Tracking State Input for the left controller leftControllerDriver.trackingStateInput = "{LeftHand}/trackingState"; } } } ``` -------------------------------- ### Initiate Socket Snapping (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Interactors This C# method starts the socket snapping process for an XRGrabInteractable. It returns true if successful, and false if snapping has already begun or if the socket limit is reached. The method manages interactables within socket grab transformers and associated lists. ```csharp protected virtual bool StartSocketSnapping(XRGrabInteractable grabInteractable) { // Implementation to start socket snapping return true; // Placeholder } ``` -------------------------------- ### Configure XR Input Value Readers Source: https://context7.com/context7/unity3d_packages_com_unity_xr_interaction_toolkit_3_3/llms.txt Sets up and reads values from XR input actions like buttons and analog axes using InputActionReference. It requires Unity's Input System and XR Interaction Toolkit packages. The readers are configured in Start and their values are read in Update. ```csharp using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.XR.Interaction.Toolkit; using UnityEngine.XR.Interaction.Toolkit.Inputs.Readers; public class InputReaderExample : MonoBehaviour { [SerializeField] private InputActionReference selectActionReference; [SerializeField] private InputActionReference moveActionReference; private XRInputButtonReader selectReader; private XRInputValueReader moveReader; void Start() { // Setup button reader for select input selectReader = new XRInputButtonReader("Select") { inputSourceMode = XRInputButtonReader.InputSourceMode.InputActionReference }; // Setup value reader for move input moveReader = new XRInputValueReader("Move") { inputSourceMode = XRInputValueReader.InputSourceMode.InputActionReference }; Debug.Log("Input readers configured"); } void Update() { // Read button state if (selectReader.ReadWasPerformedThisFrame()) { Debug.Log("Select button pressed this frame"); } if (selectReader.ReadIsPerformed()) { Debug.Log("Select button is currently held"); } // Read analog value Vector2 moveValue = moveReader.ReadValue(); if (moveValue.magnitude > 0.1f) { Debug.Log($"Move input: {moveValue}"); } } } ``` -------------------------------- ### Manual Namespace Update with Using Statement (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/manual/upgrade-guide-3 Illustrates how to manually resolve lengthy namespace paths after an automatic update by adding a 'using' statement. This allows for the use of classes from new namespaces with their short names. ```csharp using UnityEngine.XR.Interaction.Toolkit.Interactables; ... XRBaseInteractable m_Interactable; ``` -------------------------------- ### Jump Method in Unity C# Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Jump Initiates the jump routine. This method is part of the GravityProvider class and is intended to be called to start the player's jump sequence. It may have dependencies on internal states like 'isJumping' and 'disableGravityDuringJump'. ```csharp public void Jump() { // Implementation details for initiating the jump routine } ``` -------------------------------- ### Setup Unity XR Teleportation System (C#) Source: https://context7.com/context7/unity3d_packages_com_unity_xr_interaction_toolkit_3_3/llms.txt This C# script configures a comprehensive teleportation system for Unity's XR Interaction Toolkit. It automatically adds and sets up necessary components like TeleportationProvider, TeleportationArea, TeleportationAnchor, and XRRayInteractors for both left and right controllers. It requires a GameObject with a TeleportationProvider, and Transforms for the left and right controller, and assumes a 'Teleport' interaction layer is defined. ```csharp using UnityEngine; using UnityEngine.XR.Interaction.Toolkit; using UnityEngine.XR.Interaction.Toolkit.Locomotion.Teleportation; public class TeleportationSetup : MonoBehaviour { [SerializeField] private LayerMask teleportationMask; [SerializeField] private Transform leftControllerTransform; [SerializeField] private Transform rightControllerTransform; void Start() { // Add Teleportation Provider to XR Origin var teleportProvider = gameObject.AddComponent(); // Create teleportation areas CreateTeleportationArea(); // Create teleportation anchors CreateTeleportationAnchor(); // Setup teleportation ray interactors on controllers SetupTeleportRayInteractor(leftControllerTransform, "Left"); SetupTeleportRayInteractor(rightControllerTransform, "Right"); Debug.Log("Teleportation system configured"); } void CreateTeleportationArea() { // Create a floor plane as teleportation area var areaObj = GameObject.CreatePrimitive(PrimitiveType.Plane); areaObj.name = "Teleportation Area"; areaObj.transform.position = Vector3.zero; areaObj.transform.localScale = new Vector3(5, 1, 5); var teleportArea = areaObj.AddComponent(); teleportArea.teleportationProvider = GetComponent(); teleportArea.interactionLayerMask = InteractionLayerMask.GetMask("Teleport"); // Configure teleportation trigger (Collider or Collider Stay) teleportArea.teleportTrigger = BaseTeleportationInteractable.TeleportTrigger.OnSelectExited; Debug.Log("Teleportation area created"); } void CreateTeleportationAnchor() { // Create a specific teleport point with fixed orientation var anchorObj = new GameObject("Teleportation Anchor"); anchorObj.transform.position = new Vector3(5, 0, 5); var anchorCollider = anchorObj.AddComponent(); anchorCollider.size = new Vector3(1, 0.1f, 1); var teleportAnchor = anchorObj.AddComponent(); teleportAnchor.teleportationProvider = GetComponent(); teleportAnchor.interactionLayerMask = InteractionLayerMask.GetMask("Teleport"); teleportAnchor.teleportTrigger = BaseTeleportationInteractable.TeleportTrigger.OnSelectExited; // Configure anchor rotation behavior teleportAnchor.matchOrientation = MatchOrientation.WorldSpaceUp; teleportAnchor.teleportAnchorTransform = anchorObj.transform; Debug.Log("Teleportation anchor created"); } void SetupTeleportRayInteractor(Transform controllerTransform, string handName) { var rayObj = new GameObject($"{handName} Teleport Ray"); rayObj.transform.SetParent(controllerTransform); rayObj.transform.localPosition = Vector3.zero; rayObj.transform.localRotation = Quaternion.identity; var rayInteractor = rayObj.AddComponent(); rayInteractor.maxRaycastDistance = 10f; rayInteractor.lineType = XRRayInteractor.LineType.ProjectileCurve; rayInteractor.velocity = 16f; rayInteractor.acceleration = 9.8f; rayInteractor.referenceFrame = controllerTransform; // Configure to only interact with teleportation layer rayInteractor.interactionLayers = InteractionLayerMask.GetMask("Teleport"); Debug.Log($"{handName} teleport ray interactor created"); } } ``` -------------------------------- ### Bezier Interpolation for Floats, Float3s, and Vector3s - Unity C# Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Utilities Performs quadratic Bezier interpolation between start and end values. This utility supports float, float3, and Vector3 types, with float3 and Vector3 versions leveraging Burst compilation for performance. It takes start, end, interpolation factor 't', and an optional control height factor. ```csharp public static float BezierLerp(float start, float end, float t, float controlHeightFactor = 0.5f) { // Implementation details for float BezierLerp return default; } public static void BezierLerp(in float3 start, in float3 end, float t, out float3 result, float controlHeightFactor = 0.5f) { // Implementation details for float3 BezierLerp result = default; } public static Vector3 BezierLerp(in Vector3 start, in Vector3 end, float t, float controlHeightFactor = 0.5f) { // Implementation details for Vector3 BezierLerp return default; } ``` -------------------------------- ### SimpleAudioFeedback Component Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Feedback Documentation for the SimpleAudioFeedback MonoBehaviour component. ```APIDOC ## SimpleAudioFeedback Component API ### Description Component that responds to select and hover events by playing audio clips. ### Class `SimpleAudioFeedback` ### Namespace `UnityEngine.XR.Interaction.Toolkit.Feedback` ### Inheritance - `MonoBehaviour` - `Behaviour` - `Component` - `Object` - `object` ### Properties #### allowHoverAudioWhileSelecting Whether to allow hover audio to play while the interactor is selecting an interactable. - **Type**: `bool` - **Declaration**: `public bool allowHoverAudioWhileSelecting { get; set; }` ``` -------------------------------- ### Get Last Focused Interactable (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit Retrieves the last interactable that received focus from any interactor. This property is read-only after initialization. ```csharp public IXRFocusInteractable lastFocused { get; protected set; } ``` -------------------------------- ### Constructors Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Inputs.Haptics Documentation for the constructors of the XRInputHapticImpulseProvider class. ```APIDOC ## Constructors ### XRInputHapticImpulseProvider() Initializes and returns an instance of XRInputHapticImpulseProvider. #### Declaration ```csharp public XRInputHapticImpulseProvider() ``` ### XRInputHapticImpulseProvider(string, bool, InputSourceMode) Initializes and returns an instance of XRInputHapticImpulseProvider. #### Declaration ```csharp public XRInputHapticImpulseProvider(string name = null, bool wantsInitialStateCheck = false, XRInputHapticImpulseProvider.InputSourceMode inputSourceMode = InputSourceMode.InputActionReference) ``` #### Parameters - **name** (string) - Optional - The name of the directly serialized embedded input action. - **wantsInitialStateCheck** (bool) - Optional - Whether the action should start performing if already actuated when the action is enabled. - **inputSourceMode** (XRInputHapticImpulseProvider.InputSourceMode) - Optional - The initial input source mode. ``` -------------------------------- ### Setting Haptic Output for Haptic Impulse Player (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/manual/create-basic-scene This C# snippet illustrates how to set the 'Haptic Output' property of a Haptic Impulse Player component to an input action binding path. This enables haptic feedback on XR devices, specifically targeting the left controller. ```csharp using UnityEngine; using UnityEngine.InputSystem; public class HapticSetup : MonoBehaviour { public HapticImpulsePlayer hapticPlayer; void Start() { if (hapticPlayer != null) { // Set Haptic Output to an input action binding path for the left controller hapticPlayer.hapticOutput = "{LeftHand}/*"; // Alternatively, for OpenXR: // hapticPlayer.hapticOutput = "haptic"; } } } ``` -------------------------------- ### XRSocketInteractor Deselect Fix Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/changelog/CHANGELOG Fixed a bug in `XRSocketInteractor` that prevented the deselection of the starting selected interactable when 'Hover Socket Snapping' was enabled. ```csharp // The deselection logic for XRSocketInteractor has been corrected. ``` -------------------------------- ### GetAttachTransform() Method Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Interactables Gets the Transform that serves as the attachment point for a given Interactor. This is an override of the base XRBaseInteractable method. ```APIDOC ## GetAttachTransform(IXRInteractor) ### Description Gets the Transform that serves as the attachment point for a given Interactor. ### Method `public override Transform GetAttachTransform(IXRInteractor interactor)` ### Parameters #### Path Parameters - **interactor** (IXRInteractor) - The specific Interactor as context to get the attachment point for. ### Returns - **Transform** - Returns the attachment point Transform. ### Overrides XRBaseInteractable.GetAttachTransform(IXRInteractor) ### Remarks This should typically return the Transform of a child GameObject or the transform itself. ### See Also - GetAttachTransform(IXRInteractable) ``` -------------------------------- ### Methods Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Inputs.Haptics Documentation for the methods of the XRInputHapticImpulseProvider class. ```APIDOC ## Methods ### DisableDirectActionIfModeUsed() Disable the directly serialized embedded input action if the mode is set to InputAction. #### Declaration ```csharp public void DisableDirectActionIfModeUsed() ``` #### See Also - `EnableDirectActionIfModeUsed()` ### EnableDirectActionIfModeUsed() Enable the directly serialized embedded input action if the mode is set to InputAction. #### Declaration ```csharp public void EnableDirectActionIfModeUsed() ``` #### See Also - `DisableDirectActionIfModeUsed()` ### GetChannelGroup() Gets the group of haptic impulse channels. #### Declaration ```csharp public IXRHapticImpulseChannelGroup GetChannelGroup() ``` #### Returns - **IXRHapticImpulseChannelGroup** - Returns the haptic impulse channel group, which may be null. ### GetObjectReference() Gets the object reference that is used as the input source to identify the output channels of a device when the mode is set to ObjectReference. #### Declaration ```csharp public IXRHapticImpulseProvider GetObjectReference() ``` #### Returns - **IXRHapticImpulseProvider** - Returns the object reference, which may be null. ### SetObjectReference(IXRHapticImpulseProvider) Sets the object reference that is used as the input source to identify the output channels of a device when the mode is set to ObjectReference. #### Declaration ```csharp public void SetObjectReference(IXRHapticImpulseProvider value) ``` #### Parameters - **value** (IXRHapticImpulseProvider) - The object reference. #### Remarks If the argument is to be serialized, it must be a Unity Object type. ``` -------------------------------- ### Get Hovered Interactable Material in Unity XR Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Interactors Retrieves the material that should be used to draw a specified hovered interactable. This method is protected and virtual. ```csharp protected virtual Material GetHoveredInteractableMaterial(IXRHoverInteractable interactable)  ``` -------------------------------- ### XRBaseInteractable.SetupRigidbodyGrab Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Interactables Sets up the Rigidbody on this object due to being grabbed. Automatically called when entering the Select state. ```APIDOC ## XRBaseInteractable.SetupRigidbodyGrab ### Description Setup the Rigidbody on this object due to being grabbed. Automatically called when entering the Select state. ### Method `protected virtual void SetupRigidbodyGrab(Rigidbody rigidbody)` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### TeleportationProvider - upTransformation Property (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Teleportation Sets or gets the transformation used to apply the up vector orientation for teleportation. It utilizes the XROriginUpAlignment enum for managing the up direction. ```csharp public XROriginUpAlignment upTransformation { get; set; } ``` -------------------------------- ### TeleportationProvider - forwardTransformation Property (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Teleportation Sets or gets the transformation used to determine the forward vector orientation for teleportation. It utilizes the XRCameraForwardXZAlignment enum for alignment. ```csharp public XRCameraForwardXZAlignment forwardTransformation { get; set; } ``` -------------------------------- ### Unity C# XRInputHapticImpulseProvider Constructors Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Inputs.Haptics Initializes and returns instances of XRInputHapticImpulseProvider. The default constructor provides a basic instance, while the parameterized constructor allows for specifying name, initial state check, and input source mode. ```csharp public XRInputHapticImpulseProvider() ``` ```csharp public XRInputHapticImpulseProvider(string name = null, bool wantsInitialStateCheck = false, XRInputHapticImpulseProvider.InputSourceMode inputSourceMode = InputSourceMode.InputActionReference) ``` -------------------------------- ### Get Interactor Source Method in C# Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Feedback Retrieves the IXRInteractor instance that this behavior should subscribe to for events. Returns the interactor source. Declared as public IXRInteractor. ```csharp public IXRInteractor GetInteractorSource() ``` -------------------------------- ### XRBaseGrabTransformer Virtual Methods Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/changelog/CHANGELOG The `Start` and `OnDestroy` methods in `XRBaseGrabTransformer` have been made virtual. This change allows derived classes to override these methods for custom initialization and cleanup logic. ```csharp protected virtual void Start() { // ... } protected virtual void OnDestroy() { // ... } ``` -------------------------------- ### XRBaseInteractable.SetupRigidbodyDrop Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Interactables Sets up the Rigidbody on this object due to being dropped. Automatically called when exiting the Select state. ```APIDOC ## XRBaseInteractable.SetupRigidbodyDrop ### Description Setup the Rigidbody on this object due to being dropped. Automatically called when exiting the Select state. ### Method `protected virtual void SetupRigidbodyDrop(Rigidbody rigidbody)` ### Endpoint N/A (Method within a class) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Select Entered Audio Clip in C# Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Feedback This property specifies the AudioClip to be played when an interactor starts selecting an interactable. It's a settable property of type AudioClip. ```csharp public AudioClip selectEnteredClip { get; set; } ``` -------------------------------- ### XRBaseInputInteractor.LogicalInputState Class Documentation Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Interactors.XRBaseInputInteractor Detailed documentation for the XRBaseInputInteractor.LogicalInputState class, including its properties and their descriptions. ```APIDOC ## XRBaseInputInteractor.LogicalInputState Class ### Description Interpreted input from an input reader. Represents the logical state of an interaction input, such as the select input, which may not be the same as the physical state of the input. ### Namespace UnityEngine.XR.Interaction.Toolkit.Interactors ### Assembly Unity.XR.Interaction.Toolkit.dll ### Syntax ```csharp public class XRBaseInputInteractor.LogicalInputState ``` ### Properties #### active Whether the logical input state is currently active. ##### Declaration ```csharp public bool active { get; } ``` ##### Property Value Type: bool Description: Indicates if the logical input state is currently active. #### isPerformed Read whether the button is currently performed, which typically means whether the button is being pressed. This is typically true for multiple frames. ##### Declaration ```csharp public bool isPerformed { get; } ``` ##### Property Value Type: bool Description: Indicates if the button is currently performed. #### mode The type of input. ##### Declaration ```csharp public XRBaseInputInteractor.InputTriggerType mode { get; set; } ``` ##### Property Value Type: XRBaseInputInteractor.InputTriggerType Description: The type of input. #### wasCompletedThisFrame Read whether the button stopped performing this frame, which typically means whether the button stopped being pressed during this frame. This is typically only true for one single frame. ##### Declaration ```csharp public bool wasCompletedThisFrame { get; } ``` ##### Property Value Type: bool Description: Indicates if the button stopped performing this frame. #### wasPerformedThisFrame Read whether the button performed this frame, which typically means whether the button started being pressed during this frame. This is typically only true for one single frame. ##### Declaration ```csharp public bool wasPerformedThisFrame { get; } ``` ##### Property Value Type: bool Description: Indicates if the button performed this frame. ### See Also - XRBaseInputInteractor.InputTriggerType ``` -------------------------------- ### TeleportationProvider - positionTransformation Property (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Teleportation Sets or gets the transformation used to apply the teleport positioning movement. It utilizes the XRBodyGroundPosition enum for managing the ground positioning. ```csharp public XRBodyGroundPosition positionTransformation { get; set; } ``` -------------------------------- ### Properties Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Inputs.Haptics Documentation for the properties of the XRInputHapticImpulseProvider class. ```APIDOC ## Properties ### inputAction The directly serialized embedded input action that is read to identify the output channels of a device when the mode is set to InputAction. #### Declaration ```csharp public InputAction inputAction { get; set; } ``` #### Property Value - **InputAction** - Description not available. ### inputActionReference The reference to an input action that is read to identify the output channels of a device when the mode is set to InputActionReference. #### Declaration ```csharp public InputActionReference inputActionReference { get; set; } ``` #### Property Value - **InputActionReference** - Description not available. ### inputSourceMode The mode that determines from which input source to get the haptic channels. By default this is set to InputActionReference to read from an input action defined in the project. #### Declaration ```csharp public XRInputHapticImpulseProvider.InputSourceMode inputSourceMode { get; set; } ``` #### Property Value - **XRInputHapticImpulseProvider.InputSourceMode** - Description not available. #### See Also - `XRInputHapticImpulseProvider.InputSourceMode` ``` -------------------------------- ### TeleportationProvider - delayTime Property (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Teleportation Sets or gets the delay time in seconds before teleportation is activated. This can be used for implementing comfort options like tunneling vignettes. ```csharp public float delayTime { get; set; } ``` -------------------------------- ### XRInputHapticImpulseProvider Class Overview Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Inputs.Haptics Provides details about the XRInputHapticImpulseProvider class, its purpose, inheritance, and implementation. ```APIDOC ## XRInputHapticImpulseProvider Class ### Description Serializable haptic impulse provider that allows for specifying the output channel or device for haptic impulses. Behaviors can declare a field of this type to allow them to output haptic impulses to a controller specified by an input action or any other source capable of returning a group of haptic channels. ### Namespace `UnityEngine.XR.Interaction.Toolkit.Inputs.Haptics` ### Assembly `Unity.XR.Interaction.Toolkit.dll` ### Syntax ```csharp [Serializable] public class XRInputHapticImpulseProvider : IXRHapticImpulseProvider ``` ``` -------------------------------- ### SnapTurnProvider Methods Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Turning Outlines the methods of the SnapTurnProvider, including utility functions for calculating turn amounts, and lifecycle methods like OnEnable, OnDisable, and Update. It also includes a method to initiate turning. ```csharp protected virtual float GetTurnAmount(Vector2 input) protected void OnDisable() protected void OnEnable() protected void StartTurn(float amount) protected void Update() ``` -------------------------------- ### HandMenu Class Documentation Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.UI.BodyUI Provides details about the HandMenu class, its inheritance, and its attributes. ```APIDOC ## Class HandMenu Makes a GameObject follow a tracked hand or motion controller with logic for setting visibility of the menu based on the palm orientation. This can be used, for example, to show a preferences menu when the user is looking at their palm. ### Inheritance object Object Component Behaviour MonoBehaviour HandMenu ### Inherited Members MonoBehaviour.IsInvoking() MonoBehaviour.CancelInvoke() MonoBehaviour.Invoke(string, float) MonoBehaviour.InvokeRepeating(string, float, float) MonoBehaviour.CancelInvoke(string) MonoBehaviour.IsInvoking(string) MonoBehaviour.StartCoroutine(string) MonoBehaviour.StartCoroutine(string, object) MonoBehaviour.StartCoroutine(IEnumerator) MonoBehaviour.StopCoroutine(IEnumerator) MonoBehaviour.StopCoroutine(Coroutine) MonoBehaviour.StopCoroutine(string) MonoBehaviour.StopAllCoroutines() MonoBehaviour.print(object) MonoBehaviour.useGUILayout MonoBehaviour.runInEditMode Behaviour.enabled Behaviour.isActiveAndEnabled Component.GetComponent(Type) Component.GetComponent() Component.TryGetComponent(Type, out Component) Component.TryGetComponent(out T) Component.GetComponent(string) Component.GetComponentInChildren(Type, bool) Component.GetComponentInChildren(Type) Component.GetComponentInChildren(bool) Component.GetComponentInChildren() Component.GetComponentsInChildren(Type, bool) Component.GetComponentsInChildren(Type) Component.GetComponentsInChildren(bool) Component.GetComponentsInChildren(bool, List) Component.GetComponentsInChildren() Component.GetComponentsInChildren(List) Component.GetComponentInParent(Type, bool) Component.GetComponentInParent(Type) Component.GetComponentInParent(bool) Component.GetComponentInParent() Component.GetComponentsInParent(Type, bool) Component.GetComponentsInParent(Type) Component.GetComponentsInParent(bool) Component.GetComponentsInParent(bool, List) Component.GetComponentsInParent() Component.GetComponents(Type) Component.GetComponents(Type, List) Component.GetComponents(List) Component.GetComponents() Component.CompareTag(string) Component.SendMessageUpwards(string, object, SendMessageOptions) Component.SendMessageUpwards(string, object) Component.SendMessageUpwards(string) Component.SendMessageUpwards(string, SendMessageOptions) Component.SendMessage(string, object) Component.SendMessage(string) Component.SendMessage(string, object, SendMessageOptions) Component.SendMessage(string, SendMessageOptions) Component.BroadcastMessage(string, object, SendMessageOptions) Component.BroadcastMessage(string, object) Component.BroadcastMessage(string) Component.BroadcastMessage(string, SendMessageOptions) Component.transform Component.gameObject Component.tag Object.GetInstanceID() Object.GetHashCode() Object.Equals(object) Object.Instantiate(Object, Vector3, Quaternion) Object.Instantiate(Object, Vector3, Quaternion, Transform) Object.Instantiate(Object) Object.Instantiate(Object, Transform) Object.Instantiate(Object, Transform, bool) Object.Instantiate(T) Object.Instantiate(T, Vector3, Quaternion) Object.Instantiate(T, Vector3, Quaternion, Transform) Object.Instantiate(T, Transform) Object.Instantiate(T, Transform, bool) Object.Destroy(Object, float) Object.Destroy(Object) Object.DestroyImmediate(Object, bool) Object.DestroyImmediate(Object) Object.FindObjectsOfType(Type) Object.FindObjectsOfType(Type, bool) Object.FindObjectsByType(Type, FindObjectsSortMode) Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode) Object.DontDestroyOnLoad(Object) Object.FindObjectsOfType() Object.FindObjectsByType(FindObjectsSortMode) Object.FindObjectsOfType(bool) Object.FindObjectsByType(FindObjectsInactive, FindObjectsSortMode) Object.FindObjectOfType() Object.FindObjectOfType(bool) Object.FindFirstObjectByType() Object.FindAnyObjectByType() Object.FindFirstObjectByType(FindObjectsInactive) Object.FindAnyObjectByType(FindObjectsInactive) Object.FindObjectOfType(Type) Object.FindFirstObjectByType(Type) Object.FindAnyObjectByType(Type) Object.FindObjectOfType(Type, bool) Object.FindFirstObjectByType(Type, FindObjectsInactive) Object.FindAnyObjectByType(Type, FindObjectsInactive) Object.ToString() Object.name Object.hideFlags object.Equals(object, object) object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) ### Namespace UnityEngine.XR.Interaction.Toolkit.UI.BodyUI ### Assembly Unity.XR.Interaction.Toolkit.dll ### Syntax ```csharp [AddComponentMenu("XR/Hand Menu", 22)] [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/api/UnityEngine.XR.Interaction.Toolkit.UI.BodyUI.HandMenu.html")] public class HandMenu : MonoBehaviour ``` ``` -------------------------------- ### XR Interaction Toolkit Overview Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction This section details the core components and functionalities within the UnityEngine.XR.Interaction.Toolkit namespace, crucial for building XR experiences. ```APIDOC ## Namespace: UnityEngine.XR.Interaction.Toolkit This namespace contains the primary classes and structures for managing XR interactions within Unity. ### Key Classes * **ActivateEvent**: Represents a UnityEvent invoked when an Interactor activates an Interactable. * **ActivateEventArgs**: Event data for activation events. * **BaseInteractionEventArgs**: Base event data for interaction events. * **BaseRegistrationEventArgs**: Base event data for registration events. * **XRInteractionManager**: Manages the communication between Interactors and Interactables. * **XRControllerRecorder**: Controls interaction recording and playback. * **XRControllerRecording**: Stores XR controller state data for playback. * **XRControllerState**: Represents a serializable state of an XR Interactor. ### Key Structs * **InteractionLayerMask**: Specifies Interaction Layers for XR interactions. * **InteractionState**: Holds logical input state for an interaction. ### Key Interfaces * **IInteractorDistanceEvaluator**: Defines a method for calculating distance between Interactor and Interactable. * **IXRParentInteractableLink**: Represents an interactable with an optional reference to a parent interactable. ``` -------------------------------- ### Unity C#: Grab Object Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Interactables Updates the state of an object when it is grabbed, signifying the start of an interaction. This method is automatically invoked when an object enters the 'Select' state. ```csharp protected virtual void Grab() { // Implementation details here } ``` -------------------------------- ### Play Select Entered Sound in C# Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Feedback This boolean property determines if a sound is played when an interactor starts selecting an interactable. It's a settable property of type bool. ```csharp public bool playSelectEntered { get; set; } ``` -------------------------------- ### Configure Basic Grabbable Object Source: https://context7.com/context7/unity3d_packages_com_unity_xr_interaction_toolkit_3_3/llms.txt Provides a C# script to programmatically set up a grabbable object in Unity's XR Interaction Toolkit. It configures movement, tracking, and selection properties, and ensures the GameObject has a Rigidbody and Collider. Requires UnityEngine.XR.Interaction.Toolkit and UnityEngine.XR.Interaction.Toolkit.Interactables. ```csharp using UnityEngine; using UnityEngine.XR.Interaction.Toolkit; using UnityEngine.XR.Interaction.Toolkit.Interactables; public class GrabbableObjectSetup : MonoBehaviour { void Start() { // Programmatic setup of a grabbable object var grabInteractable = gameObject.AddComponent(); // Configure movement behavior grabInteractable.movementType = XRBaseInteractable.MovementType.VelocityTracking; grabInteractable.throwOnDetach = true; grabInteractable.throwSmoothingDuration = 0.25f; grabInteractable.throwVelocityScale = 1.5f; // Configure tracking grabInteractable.trackPosition = true; grabInteractable.trackRotation = true; grabInteractable.smoothPosition = true; grabInteractable.smoothRotation = true; // Configure selection mode grabInteractable.selectMode = InteractableSelectMode.Single; // Add Rigidbody if not present (required for physics-based movement) if (!gameObject.TryGetComponent(out var rb)) { rb = gameObject.AddComponent(); rb.useGravity = true; rb.mass = 1f; } // Add collider if not present (required for physics detection) if (!gameObject.TryGetComponent(out _)) { var boxCollider = gameObject.AddComponent(); boxCollider.size = Vector3.one; } Debug.Log("Grabbable object configured successfully"); } } ``` -------------------------------- ### TeleportationProvider - validRequest Property (C#) Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Locomotion.Teleportation Gets or sets a boolean value indicating whether the current teleportation request is valid. This is a protected property used internally by the provider. ```csharp protected bool validRequest { get; set; } ``` -------------------------------- ### StartSocketSnapping Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Interactors Initiates socket snapping for a specified XRGrabInteractable object. ```APIDOC ## protected virtual bool StartSocketSnapping(XRGrabInteractable grabInteractable) ### Description Initiates socket snapping for a given XRGrabInteractable. This method handles the logic for adding the interactable to the socket grab transformer and updating relevant lists. ### Method protected virtual bool ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **grabInteractable** (XRGrabInteractable) - The XRGrabInteractable object to initiate socket snapping for. ### Request Example ```csharp // Example usage: public class MyInteractable : XRGrabInteractable { protected override void OnSelectEntered(SelectEnterEventArgs args) { base.OnSelectEntered(args); if (StartSocketSnapping(this)) { Debug.Log("Socket snapping started successfully."); } else { Debug.Log("Failed to start socket snapping."); } } } ``` ### Response #### Success Response (200) - **bool** - Returns true if the operation is successful; false if the socket snapping has already started for the interactable or if the number of interactables with socket transformer exceeds the socket limit. #### Response Example ```json { "returnValue": true } ``` ### Remarks If the socket snapping has already started for the interactable, or if the number of interactables with socket transformer exceeds the socket limit, the method does nothing. Otherwise, it adds the specified grab interactable to the socket grab transformer and adds it to the global and local interactables with socket transformer lists. ### See Also - EndSocketSnapping(XRGrabInteractable) ``` -------------------------------- ### Play Hover Entered Sound in C# Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Feedback This boolean property determines whether a sound is played when an interactor starts hovering over an interactable. It's a settable property of type bool. ```csharp public bool playHoverEntered { get; set; } ``` -------------------------------- ### XRBaseInputInteractor.LogicalInputState 'wasPerformedThisFrame' Property Source: https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.3/Packages/com.unity.xr.interaction.toolkit%403.3/api/UnityEngine.XR.Interaction.Toolkit.Interactors.XRBaseInputInteractor This C# code illustrates accessing the 'wasPerformedThisFrame' property of the XRBaseInputInteractor.LogicalInputState class. This boolean property is true if the input started performing within the current frame. ```csharp public bool wasPerformedThisFrame { get; } ```