Class SimpleHapticFeedback
Component that responds to select and hover events by playing haptic impulses (in other words, vibrating the controller).
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Feedback
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[AddComponentMenu("XR/Feedback/Simple Haptic Feedback", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.4/api/UnityEngine.XR.Interaction.Toolkit.Feedback.SimpleHapticFeedback.html")]
public class SimpleHapticFeedback : MonoBehaviourProperties
allowHoverHapticsWhileSelecting
Whether to allow hover haptics to play while the interactor is selecting an interactable.
Declaration
public bool allowHoverHapticsWhileSelecting { get; set; }Property Value
| Type | Description | 
|---|---|
| bool | 
See Also
hapticImpulsePlayer
The Haptic Impulse Player component to use to play haptic impulses.
Declaration
public HapticImpulsePlayer hapticImpulsePlayer { get; set; }Property Value
| Type | Description | 
|---|---|
| HapticImpulsePlayer | 
See Also
hoverCanceledData
The haptic impulse to play when the interactor stops hovering over an interactable due to being canceled.
Declaration
public HapticImpulseData hoverCanceledData { get; set; }Property Value
| Type | Description | 
|---|---|
| HapticImpulseData | 
See Also
hoverEnteredData
The haptic impulse to play when the interactor starts hovering over an interactable.
Declaration
public HapticImpulseData hoverEnteredData { get; set; }Property Value
| Type | Description | 
|---|---|
| HapticImpulseData | 
See Also
hoverExitedData
The haptic impulse to play when the interactor stops hovering over an interactable without being canceled.
Declaration
public HapticImpulseData hoverExitedData { get; set; }Property Value
| Type | Description | 
|---|---|
| HapticImpulseData | 
See Also
playHoverCanceled
Whether to play a haptic impulse when the interactor stops hovering over an interactable due to being canceled.
Declaration
public bool playHoverCanceled { get; set; }Property Value
| Type | Description | 
|---|---|
| bool | 
See Also
playHoverEntered
Whether to play a haptic impulse when the interactor starts hovering over an interactable.
Declaration
public bool playHoverEntered { get; set; }Property Value
| Type | Description | 
|---|---|
| bool | 
See Also
playHoverExited
Whether to play a haptic impulse when the interactor stops hovering over an interactable without being canceled.
Declaration
public bool playHoverExited { get; set; }Property Value
| Type | Description | 
|---|---|
| bool | 
See Also
playSelectCanceled
Whether to play a haptic impulse when the interactor stops selecting an interactable due to being canceled.
Declaration
public bool playSelectCanceled { get; set; }Property Value
| Type | Description | 
|---|---|
| bool | 
See Also
playSelectEntered
Whether to play a haptic impulse when the interactor starts selecting an interactable.
Declaration
public bool playSelectEntered { get; set; }Property Value
| Type | Description | 
|---|---|
| bool | 
See Also
playSelectExited
Whether to play a haptic impulse when the interactor stops selecting an interactable without being canceled.
Declaration
public bool playSelectExited { get; set; }Property Value
| Type | Description | 
|---|---|
| bool | 
See Also
selectCanceledData
The haptic impulse to play when the interactor stops selecting an interactable due to being canceled.
Declaration
public HapticImpulseData selectCanceledData { get; set; }Property Value
| Type | Description | 
|---|---|
| HapticImpulseData | 
See Also
selectEnteredData
The haptic impulse to play when the interactor starts selecting an interactable.
Declaration
public HapticImpulseData selectEnteredData { get; set; }Property Value
| Type | Description | 
|---|---|
| HapticImpulseData | 
See Also
selectExitedData
The haptic impulse to play when the interactor stops selecting an interactable without being canceled.
Declaration
public HapticImpulseData selectExitedData { get; set; }Property Value
| Type | Description | 
|---|---|
| HapticImpulseData | 
See Also
Methods
Awake()
See MonoBehaviour.
Declaration
protected void Awake()See Also
GetInteractorSource()
Gets the interactor this behavior should subscribe to for events.
Declaration
public IXRInteractor GetInteractorSource()Returns
| Type | Description | 
|---|---|
| IXRInteractor | Returns the interactor this behavior should subscribe to for events. | 
See Also
OnDisable()
See MonoBehaviour.
Declaration
protected void OnDisable()See Also
OnEnable()
See MonoBehaviour.
Declaration
protected void OnEnable()See Also
Reset()
See MonoBehaviour.
Declaration
[Conditional("UNITY_EDITOR")]
protected void Reset()See Also
SendHapticImpulse(float, float, float)
Sends a haptic impulse to the referenced haptic impulse player component.
Declaration
protected bool SendHapticImpulse(float amplitude, float duration, float frequency)Parameters
| Type | Name | Description | 
|---|---|---|
| float | amplitude | The desired motor amplitude that should be within a [0-1] range. | 
| float | duration | The desired duration of the impulse in seconds. | 
| float | frequency | The desired frequency of the impulse in Hz. A value of 0 means to use the default frequency of the device. | 
Returns
| Type | Description | 
|---|---|
| bool | 
See Also
SendHapticImpulse(HapticImpulseData)
Sends a haptic impulse to the referenced haptic impulse player component.
Declaration
protected bool SendHapticImpulse(HapticImpulseData data)Parameters
| Type | Name | Description | 
|---|---|---|
| HapticImpulseData | data | The parameters of the haptic impulse. | 
Returns
| Type | Description | 
|---|---|
| bool | 
See Also
SetInteractorSource(IXRInteractor)
Sets the interactor this behavior should subscribe to for events.
Declaration
public void SetInteractorSource(IXRInteractor interactor)Parameters
| Type | Name | Description | 
|---|---|---|
| IXRInteractor | interactor | The interactor this behavior should subscribe to for events. | 
Remarks
This also sets the serialized field to the given interactor as a Unity Object.