docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ActionBasedController

    Interprets feature values on a tracked input controller device using actions from the Input System into XR Interaction states, such as Select. Additionally, it applies the current Pose value of a tracked device to the transform of the GameObject.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    XRBaseController
    ActionBasedController
    Inherited Members
    XRBaseController.updateTrackingType
    XRBaseController.enableInputTracking
    XRBaseController.enableInputActions
    XRBaseController.modelPrefab
    XRBaseController.modelParent
    XRBaseController.model
    XRBaseController.animateModel
    XRBaseController.modelSelectTransition
    XRBaseController.modelDeSelectTransition
    XRBaseController.hideControllerModel
    XRBaseController.selectInteractionState
    XRBaseController.activateInteractionState
    XRBaseController.uiPressInteractionState
    XRBaseController.uiScrollValue
    XRBaseController.currentControllerState
    XRBaseController.Awake()
    XRBaseController.Update()
    XRBaseController.GetModelPrefab()
    XRBaseController.UpdateController()
    XRBaseController.OnBeforeRender()
    XRBaseController.FixedUpdate()
    XRBaseController.ApplyControllerState(XRInteractionUpdateOrder.UpdatePhase, XRControllerState)
    XRBaseController.UpdateControllerModelAnimation()
    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<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, bool)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>(bool)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    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>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(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<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(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
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    [AddComponentMenu("XR/XR Controller (Action-based)", 11)]
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@2.5/api/UnityEngine.XR.Interaction.Toolkit.ActionBasedController.html")]
    public class ActionBasedController : XRBaseController
    Remarks

    This behavior requires that the Input System is enabled in the Active Input Handling setting in Edit > Project Settings > Player for input values to be read. Each input action must also be enabled to read the current value of the action. Referenced input actions in an Input Action Asset are not enabled by default.

    Properties

    activateAction

    The Input System action to use for activating a selected Interactable. Must be an action with a button-like interaction where phase equals performed when pressed. Typically a UnityEngine.InputSystem.Controls.ButtonControl Control or a Value type action with a Press or Sector interaction.

    Declaration
    public InputActionProperty activateAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    activateActionValue

    activateActionValue

    The Input System action to read values for activating a selected Interactable. Must be an UnityEngine.InputSystem.Controls.AxisControl Control or UnityEngine.InputSystem.Controls.Vector2Control Control.

    Declaration
    public InputActionProperty activateActionValue { get; set; }
    Property Value
    Type Description
    InputActionProperty
    Remarks

    Optional, Unity uses activateAction when not set.

    See Also
    activateAction

    directionalAnchorRotationAction

    The Input System action to use for computing a direction angle to rotate the interactor's attach point to match it. Must be a UnityEngine.InputSystem.Controls.Vector2Control Control. The direction angle should be computed as the arctangent function of x/y.

    Declaration
    public InputActionProperty directionalAnchorRotationAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    XRBaseController

    hapticDeviceAction

    The Input System action to use for identifying the device to send haptic impulses to. Can be any control type that will have an active control driving the action.

    Declaration
    public InputActionProperty hapticDeviceAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    XRBaseController

    isTrackedAction

    The Input System action to read the Is Tracked state when updating this GameObject position and rotation; falls back to the tracked device's is tracked state that drives the position or rotation action when not set. Must be an action with a button-like interaction where phase equals performed when is tracked. Typically a UnityEngine.InputSystem.Controls.ButtonControl Control.

    Declaration
    public InputActionProperty isTrackedAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    XRBaseController

    positionAction

    The Input System action to use for Position Tracking for this GameObject. Must be a UnityEngine.InputSystem.Controls.Vector3Control Control.

    Declaration
    public InputActionProperty positionAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    XRBaseController

    rotateAnchorAction

    The Input System action to use for rotating the interactor's attach point over time. Must be a UnityEngine.InputSystem.Controls.Vector2Control Control. Uses the x-axis as the rotation input.

    Declaration
    public InputActionProperty rotateAnchorAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    XRBaseController

    rotationAction

    The Input System action to use for Rotation Tracking for this GameObject. Must be a UnityEngine.InputSystem.Controls.QuaternionControl Control.

    Declaration
    public InputActionProperty rotationAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    XRBaseController

    scaleDeltaAction

    The Input System action to use for providing a scale delta value to transformers. Must be a UnityEngine.InputSystem.Controls.Vector2Control Control. Uses the y-axis as the scale input.

    Declaration
    public InputActionProperty scaleDeltaAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    IXRScaleValueProvider

    scaleToggleAction

    The Input System action to use to enable or disable reading from the Scale Delta Action. Must be a UnityEngine.InputSystem.Controls.ButtonControl Control. The pressed state of the button will toggle the scale state.

    Declaration
    public InputActionProperty scaleToggleAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    scaleDeltaAction

    selectAction

    The Input System action to use for selecting an Interactable. Must be an action with a button-like interaction where phase equals performed when pressed. Typically a UnityEngine.InputSystem.Controls.ButtonControl Control or a Value type action with a Press or Sector interaction.

    Declaration
    public InputActionProperty selectAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    selectActionValue

    selectActionValue

    The Input System action to read values for selecting an Interactable. Must be an UnityEngine.InputSystem.Controls.AxisControl Control or UnityEngine.InputSystem.Controls.Vector2Control Control.

    Declaration
    public InputActionProperty selectActionValue { get; set; }
    Property Value
    Type Description
    InputActionProperty
    Remarks

    Optional, Unity uses selectAction when not set.

    See Also
    selectAction

    trackingStateAction

    The Input System action to read the Tracking State when updating this GameObject position and rotation; falls back to the tracked device's tracking state that drives the position or rotation action when not set. Must be an UnityEngine.InputSystem.Controls.IntegerControl Control.

    Declaration
    public InputActionProperty trackingStateAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    InputTrackingState

    translateAnchorAction

    The Input System action to use for translating the interactor's attach point closer or further away from the interactor. Must be a UnityEngine.InputSystem.Controls.Vector2Control Control. Uses the y-axis as the translation input.

    Declaration
    public InputActionProperty translateAnchorAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    XRBaseController

    uiPressAction

    The Input System action to use for Canvas UI interaction. Must be an action with a button-like interaction where phase equals performed when pressed. Typically a UnityEngine.InputSystem.Controls.ButtonControl Control or a Value type action with a Press interaction.

    Declaration
    public InputActionProperty uiPressAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    uiPressActionValue

    uiPressActionValue

    The Input System action to read values for Canvas UI interaction. Must be an UnityEngine.InputSystem.Controls.AxisControl Control or UnityEngine.InputSystem.Controls.Vector2Control Control.

    Declaration
    public InputActionProperty uiPressActionValue { get; set; }
    Property Value
    Type Description
    InputActionProperty
    Remarks

    Optional, Unity uses uiPressAction when not set.

    See Also
    uiPressAction

    uiScrollAction

    The Input System action to read values for Canvas UI scrolling. Must be a UnityEngine.InputSystem.Controls.Vector2Control Control.

    Declaration
    public InputActionProperty uiScrollAction { get; set; }
    Property Value
    Type Description
    InputActionProperty
    See Also
    uiPressAction

    Methods

    IsPressed(InputAction)

    Evaluates whether the given input action is considered performed. Unity automatically calls this method during UpdateInput(XRControllerState) to determine if the interaction state is active this frame.

    Declaration
    protected virtual bool IsPressed(InputAction action)
    Parameters
    Type Name Description
    InputAction action

    The input action to check.

    Returns
    Type Description
    bool

    Returns true when the input action is considered performed. Otherwise, returns false.

    Remarks

    More accurately, this evaluates whether the action with a button-like interaction is performed. Depending on the interaction of the input action, the control driving the value of the input action may technically be pressed and though the interaction may be in progress, it may not yet be performed, such as for a Hold interaction. In that example, this method returns false.

    See Also
    active

    OnDisable()

    See MonoBehaviour.

    Declaration
    protected override void OnDisable()
    Overrides
    XRBaseController.OnDisable()
    See Also
    XRBaseController

    OnEnable()

    See MonoBehaviour.

    Declaration
    protected override void OnEnable()
    Overrides
    XRBaseController.OnEnable()
    See Also
    XRBaseController

    ReadValue(InputAction)

    Reads and returns the given action value. Unity automatically calls this method during UpdateInput(XRControllerState) to determine the amount or strength of the interaction state this frame.

    Declaration
    protected virtual float ReadValue(InputAction action)
    Parameters
    Type Name Description
    InputAction action

    The action to read the value from.

    Returns
    Type Description
    float

    Returns the action value. If the action is null returns the default float value (0f).

    See Also
    value

    SendHapticImpulse(float, float)

    Play a haptic impulse on the controller if one is available.

    Declaration
    public override bool SendHapticImpulse(float amplitude, float duration)
    Parameters
    Type Name Description
    float amplitude

    Amplitude (from 0.0 to 1.0) to play impulse at.

    float duration

    Duration (in seconds) to play haptic impulse.

    Returns
    Type Description
    bool

    Returns true if successful. Otherwise, returns false.

    Overrides
    XRBaseController.SendHapticImpulse(float, float)
    See Also
    XRBaseController

    UpdateInput(XRControllerState)

    Updates the XR Interaction states in the given controller state based on the current inputs of the controller device. Unity calls this automatically during UpdateController() so explicit calls to this function are not required.

    Declaration
    protected override void UpdateInput(XRControllerState controllerState)
    Parameters
    Type Name Description
    XRControllerState controllerState

    The state of the controller.

    Overrides
    XRBaseController.UpdateInput(XRControllerState)
    See Also
    XRBaseController

    UpdateTrackingInput(XRControllerState)

    Updates the pose values in the given controller state based on the current tracking input of the controller device. Unity calls this automatically from FixedUpdate(), OnBeforeRender(), and UpdateController() so explicit calls to this function are not required.

    Declaration
    protected override void UpdateTrackingInput(XRControllerState controllerState)
    Parameters
    Type Name Description
    XRControllerState controllerState

    The state of the controller.

    Overrides
    XRBaseController.UpdateTrackingInput(XRControllerState)
    See Also
    XRBaseController

    See Also

    XRBaseController
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)