docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct XRSimulatedControllerState

    State for input device representing a simulated XR handed controller.

    Implements
    IInputStateTypeInfo
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.Interaction.Toolkit.Inputs.Simulation
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    public struct XRSimulatedControllerState : IInputStateTypeInfo

    Fields

    batteryLevel

    Value representing the current battery life of this device.

    Declaration
    public float batteryLevel
    Field Value
    Type Description
    float

    buttons

    All the buttons on this device.

    Declaration
    public ushort buttons
    Field Value
    Type Description
    ushort

    devicePosition

    The position of the device.

    Declaration
    public Vector3 devicePosition
    Field Value
    Type Description
    Vector3

    deviceRotation

    The rotation of this device.

    Declaration
    public Quaternion deviceRotation
    Field Value
    Type Description
    Quaternion

    grip

    Represents the user's grip on the controller.

    Declaration
    public float grip
    Field Value
    Type Description
    float

    isTracked

    Informs to the developer whether the device is currently being tracked.

    Declaration
    public bool isTracked
    Field Value
    Type Description
    bool

    primary2DAxis

    The primary touchpad or joystick on a device.

    Declaration
    public Vector2 primary2DAxis
    Field Value
    Type Description
    Vector2

    secondary2DAxis

    A secondary touchpad or joystick on a device.

    Declaration
    public Vector2 secondary2DAxis
    Field Value
    Type Description
    Vector2

    trackingState

    Represents the values being tracked for this device.

    Declaration
    public int trackingState
    Field Value
    Type Description
    int

    trigger

    A trigger-like control, pressed with the index finger.

    Declaration
    public float trigger
    Field Value
    Type Description
    float

    Properties

    format

    The data format identifier of the state.

    Declaration
    public FourCC format { get; }
    Property Value
    Type Description
    FourCC

    formatId

    Memory format identifier for XRSimulatedControllerState.

    Declaration
    public static FourCC formatId { get; }
    Property Value
    Type Description
    FourCC
    See Also
    format

    Methods

    HasButton(ControllerButton)

    Gets whether the button mask has the given button set.

    Declaration
    public bool HasButton(ControllerButton button)
    Parameters
    Type Name Description
    ControllerButton button

    Button whose state is queried.

    Returns
    Type Description
    bool

    Returns true if the button bit mask has the button set.

    See Also
    buttons

    Reset()

    Resets the value of all fields to default or the identity rotation.

    Declaration
    public void Reset()

    WithButton(ControllerButton, bool)

    Set the button mask for the given button.

    Declaration
    public XRSimulatedControllerState WithButton(ControllerButton button, bool state = true)
    Parameters
    Type Name Description
    ControllerButton button

    Button whose state to set.

    bool state

    Whether to set the bit on or off.

    Returns
    Type Description
    XRSimulatedControllerState

    The same XRSimulatedControllerState with the change applied.

    See Also
    buttons

    Implements

    UnityEngine.InputSystem.LowLevel.IInputStateTypeInfo
    In This Article
    Back to top
    Copyright © 2025 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)