Struct XRSimulatedControllerState
State for input device representing a simulated XR handed controller.
Implements
Inherited Members
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
See IInputStateTypeInfo.format.
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
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
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. |