Class XRController
XRController MonoBehaviour that interprets InputSystem events into XR Interaction Interactor position, rotation and interaction states.
Namespace: UnityEngine.XR.Interaction.Toolkit
Syntax
public class XRController : MonoBehaviour
Properties
activateUsage
Gets or sets the usage to use for detecting activation.
Declaration
public InputHelpers.Button activateUsage { get; set; }
Property Value
Type | Description |
---|---|
InputHelpers.Button |
animateModel
Gets or sets whether this model animates in response to interaction events.
Declaration
public bool animateModel { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
axisToPressThreshold
Gets or sets the the amount the axis needs to be pressed to trigger an interaction event.
Declaration
public float axisToPressThreshold { get; set; }
Property Value
Type | Description |
---|---|
Single |
controllerNode
Gets or sets the XRNode for this controller.
Declaration
public XRNode controllerNode { get; set; }
Property Value
Type | Description |
---|---|
XRNode |
enableInputActions
Declaration
public bool enableInputActions { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
enableInputTracking
Gets or sets if input is enabled for this controller.
Declaration
public bool enableInputTracking { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
hideControllerModel
Gets or sets whether the controller model should be hidden.
Declaration
public bool hideControllerModel { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
inputDevice
Gets the InputDevice being used to read data from.
Declaration
public InputDevice inputDevice { get; }
Property Value
Type | Description |
---|---|
InputDevice |
modelDeSelectTransition
Gets or sets the animation transition to enable when de-selecting.
Declaration
public string modelDeSelectTransition { get; set; }
Property Value
Type | Description |
---|---|
String |
modelPrefab
Gets or sets the model prefab to show for this controller.
Declaration
public Transform modelPrefab { get; set; }
Property Value
Type | Description |
---|---|
Transform |
modelSelectTransition
Gets or sets the animation transition to enable when selecting.
Declaration
public string modelSelectTransition { get; set; }
Property Value
Type | Description |
---|---|
String |
modelTransform
Gets or sets the model transform that is used as the parent for the controller model. Note: setting this will not automatically destroy the previous model transform object.
Declaration
public Transform modelTransform { get; }
Property Value
Type | Description |
---|---|
Transform |
selectUsage
Gets or sets the usage to use for detecting selection.
Declaration
public InputHelpers.Button selectUsage { get; set; }
Property Value
Type | Description |
---|---|
InputHelpers.Button |
uiPressUsage
Gets or sets the usage to use for detecting a UI press.
Declaration
public InputHelpers.Button uiPressUsage { get; set; }
Property Value
Type | Description |
---|---|
InputHelpers.Button |
updateTrackingType
The update type being used by the tracked pose driver
Declaration
public XRController.UpdateType updateTrackingType { get; set; }
Property Value
Type | Description |
---|---|
XRController.UpdateType |
Methods
Awake()
Declaration
protected virtual void Awake()
OnBeforeRender()
Declaration
protected virtual void OnBeforeRender()
OnDisable()
Declaration
protected virtual void OnDisable()
OnEnable()
Declaration
protected virtual void OnEnable()
SendHapticImpulse(Single, Single)
Play a haptic impulse on the controller if one is available
Declaration
public bool SendHapticImpulse(float amplitude, float duration)
Parameters
Type | Name | Description |
---|---|---|
Single | amplitude | Amplitude (from 0.0 to 1.0) to play impulse at. |
Single | duration | Duration (in seconds) to play haptic impulse. |
Returns
Type | Description |
---|---|
Boolean |
UpdateTrackingInput()
Declaration
protected void UpdateTrackingInput()