Class XRBaseControllerInteractor
Abstract base class from which all interactors that are controller driven derive. This class hooks into the interaction system (via XRInteractionManager) and provides base virtual methods for handling hover and selection. Additionally, this class provides functionality for checking the controller's selection status and hiding the controller on selection.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Syntax
public abstract class XRBaseControllerInteractor : XRBaseInteractor
Properties
AudioClipForOnHoverEnter
Gets or sets the AudioClip to play on Hover Enter.
Declaration
public AudioClip AudioClipForOnHoverEnter { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
AudioClipForOnHoverExit
Gets or sets the AudioClip to play on Hover Exit.
Declaration
public AudioClip AudioClipForOnHoverExit { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
AudioClipForOnSelectEnter
Gets or sets the AudioClip to play on Select Enter.
Declaration
public AudioClip AudioClipForOnSelectEnter { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
AudioClipForOnSelectExit
Gets or sets the AudioClip to play on Select Exit.
Declaration
public AudioClip AudioClipForOnSelectExit { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
hapticHoverEnterDuration
Gets or sets the Haptics duration to play on HoverEnter.
Declaration
public float hapticHoverEnterDuration { get; set; }
Property Value
Type | Description |
---|---|
Single |
hapticHoverEnterIntensity
Gets or sets the Haptics intensity to play on HoverEnter.
Declaration
public float hapticHoverEnterIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
hapticHoverExitDuration
Gets or sets the Haptics duration to play on HoverExit.
Declaration
public float hapticHoverExitDuration { get; set; }
Property Value
Type | Description |
---|---|
Single |
hapticHoverExitIntensity
Gets or sets the Haptics intensity to play on HoverExit.
Declaration
public float hapticHoverExitIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
hapticSelectEnterDuration
Gets or sets the Haptics duration to play on SelectEnter.
Declaration
public float hapticSelectEnterDuration { get; set; }
Property Value
Type | Description |
---|---|
Single |
hapticSelectEnterIntensity
Gets or sets the Haptics intensity to play on SelectEnter.
Declaration
public float hapticSelectEnterIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
hapticSelectExitDuration
Gets or sets the Haptics duration to play on SelectExit.
Declaration
public float hapticSelectExitDuration { get; set; }
Property Value
Type | Description |
---|---|
Single |
hapticSelectExitIntensity
Gets or sets the Haptics intensity to play on SelectExit.
Declaration
public float hapticSelectExitIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
hideControllerOnSelect
Gets or sets whether this interactor should hide the controller on selection.
Declaration
public bool hideControllerOnSelect { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
isSelectActive
Gets whether the selection state is active for this interactor. This will check if the controller has a valid selection state or whether toggle selection is currently on and active.
Declaration
public override bool isSelectActive { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
playAudioClipOnHoverEnter
Gets or sets whether to play AudioClip on Hover Enter.
Declaration
public bool playAudioClipOnHoverEnter { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
playAudioClipOnHoverExit
Gets or sets whether to play AudioClip on Hover Exit.
Declaration
public bool playAudioClipOnHoverExit { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
playAudioClipOnSelectEnter
Gets or sets whether to play AudioClip on Select Enter.
Declaration
public bool playAudioClipOnSelectEnter { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
playAudioClipOnSelectExit
Gets or sets whether to play AudioClip on Select Exit.
Declaration
public bool playAudioClipOnSelectExit { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
playHapticsOnHoverEnter
Gets or sets whether to play haptics on HoverEnter.
Declaration
public bool playHapticsOnHoverEnter { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
playHapticsOnHoverExit
Gets or sets whether to play haptics on HoverExit.
Declaration
public bool playHapticsOnHoverExit { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
playHapticsOnSelectEnter
Gets or sets whether to play haptics on SelectEnter.
Declaration
public bool playHapticsOnSelectEnter { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
playHapticsOnSelectExit
Gets or sets whether to play haptics on SelectExit.
Declaration
public bool playHapticsOnSelectExit { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
toggleSelect
Gets or sets whether this interactor toggles selection on button press (rather than selection on press).
Declaration
public bool toggleSelect { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Awake()
Declaration
protected override void Awake()
Overrides
OnHoverEnter(XRBaseInteractable)
This method is called when the interactor first initiates hover of an interactable.
Declaration
protected override void OnHoverEnter(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is being hovered. |
Overrides
OnHoverExit(XRBaseInteractable)
This method is called by the interaction manager when the interactor ends hovering over an interactable.
Declaration
protected override void OnHoverExit(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is no longer hovered over. |
Overrides
OnSelectEnter(XRBaseInteractable)
This method is called when the interactor first initiates selection of an interactable.
Declaration
protected override void OnSelectEnter(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is being selected. |
Overrides
OnSelectExit(XRBaseInteractable)
This method is called when the interactor ends selection of an interactable.
Declaration
protected override void OnSelectExit(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is no longer selected. |
Overrides
ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)
Declaration
public override void ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase |
Overrides
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 |