Struct XRSimulatedControllerState
State for input device representing a simulated XR handed controller.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Inputs.Simulation
Syntax
public struct XRSimulatedControllerState : IInputStateTypeInfo
Fields
batteryLevel
Value representing the current battery life of this device.
Declaration
public float batteryLevel
Field Value
Type | Description |
---|---|
Single |
buttons
All the buttons on this device.
Declaration
public ushort buttons
Field Value
Type | Description |
---|---|
UInt16 |
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 |
---|---|
Single |
isTracked
Informs to the developer whether the device is currently being tracked.
Declaration
public bool isTracked
Field Value
Type | Description |
---|---|
Boolean |
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 |
---|---|
Int32 |
trigger
A trigger-like control, pressed with the index finger.
Declaration
public float trigger
Field Value
Type | Description |
---|---|
Single |
Properties
format
See IInputStateTypeInfo.format.
Declaration
public readonly FourCC format { get; }
Property Value
Type | Description |
---|---|
FourCC |
Implements
formatId
Memory format identifier for XRSimulatedControllerState.
Declaration
public static readonly FourCC formatId { get; }
Property Value
Type | Description |
---|---|
FourCC |
See Also
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 |
---|---|
Boolean | Returns true if the button bit mask has the button set. |
See Also
Reset()
Resets the value of all fields to default or the identity rotation.
Declaration
public void Reset()
WithButton(ControllerButton, Boolean)
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. |
Boolean | state | Whether to set the bit on or off. |
Returns
Type | Description |
---|---|
XRSimulatedControllerState | The same XRSimulatedControllerState with the change applied. |