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.1/api/UnityEngine.XR.Interaction.Toolkit.Feedback.SimpleHapticFeedback.html")]
public class SimpleHapticFeedback : MonoBehaviour
Properties
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 |
---|---|
Haptic |
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 |
---|---|
Haptic |
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 |
---|---|
Haptic |
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 |
---|---|
Haptic |
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 |
---|---|
Haptic |
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 |
---|---|
Haptic |
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 |
---|---|
Haptic |
See Also
Methods
Awake()
See Mono
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 Mono
Declaration
protected void OnDisable()
See Also
OnEnable()
See Mono
Declaration
protected void OnEnable()
See Also
Reset()
See Mono
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
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 |
---|---|---|
Haptic |
data | The parameters of the haptic impulse. |
Returns
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.