You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(Interaction): add near touch to interact haptics
The Interact Haptics script now has an option for initiating haptics
on a near touch interaction event.
The Interact Haptics script has also been refactored to use the
Interactable Object events rather than having hard coded method calls
from the interaction scripts (Touch/Grab/Use) to the Interact Haptics
script.
The Interactable Object script has a new method to help subscribe
and unsubscribe from these interaction events and the Interact
Object Highlighter has also been refactored to use these new event
subscription helpers.
Copy file name to clipboardExpand all lines: Assets/VRTK/Documentation/API.md
+52Lines changed: 52 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4200,6 +4200,30 @@ The PerformSecondaryAction method returns whether the object has a secondary act
4200
4200
4201
4201
The ResetIgnoredColliders method is used to clear any stored ignored colliders in case the `Ignored Colliders` array parameter is changed at runtime. This needs to be called manually if changes are made at runtime.
* `InteractionType givenType` - The Interaction Type that the previous event subscription was under.
4221
+
* `InteractableObjectEventHandler methodCallback` - The method that was being executed when the Interaction Type was initiated.
4222
+
* Returns
4223
+
* _none_
4224
+
4225
+
The UnsubscribeFromInteractionEvent method unsubscribes a previous event subscription for the given Interaction Type.
4226
+
4203
4227
### Example
4204
4228
4205
4229
`VRTK/Examples/005_Controller_BasicObjectGrabbing` uses the `VRTK_InteractTouch` and `VRTK_InteractGrab` scripts on the controllers to show how an interactable object can be grabbed and snapped to the controller and thrown around the game world.
@@ -4314,6 +4338,10 @@ The Interact Haptics script is attached on the same GameObject as an Interactabl
4314
4338
4315
4339
### Inspector Parameters
4316
4340
4341
+
* **Clip On Near Touch:** Denotes the audio clip to use to rumble the controller on near touch.
4342
+
* **Strength On Near Touch:** Denotes how strong the rumble in the controller will be on near touch.
4343
+
* **Duration On Near Touch:** Denotes how long the rumble in the controller will last on near touch.
4344
+
* **Interval On Near Touch:** Denotes interval betweens rumble in the controller on near touch.
4317
4345
* **Clip On Touch:** Denotes the audio clip to use to rumble the controller on touch.
4318
4346
* **Strength On Touch:** Denotes how strong the rumble in the controller will be on touch.
4319
4347
* **Duration On Touch:** Denotes how long the rumble in the controller will last on touch.
@@ -4326,9 +4354,11 @@ The Interact Haptics script is attached on the same GameObject as an Interactabl
4326
4354
* **Strength On Use:** Denotes how strong the rumble in the controller will be on use.
4327
4355
* **Duration On Use:** Denotes how long the rumble in the controller will last on use.
4328
4356
* **Interval On Use:** Denotes interval betweens rumble in the controller on use.
4357
+
* **Object To Affect:** The Interactable Object to initiate the haptics from. If this is left blank, then the Interactable Object will need to be on the current or a parent GameObject.
4329
4358
4330
4359
### Class Events
4331
4360
4361
+
* `InteractHapticsNearTouched` - Emitted when the haptics are from a near touch.
4332
4362
* `InteractHapticsTouched` - Emitted when the haptics are from a touch.
4333
4363
* `InteractHapticsGrabbed` - Emitted when the haptics are from a grab.
4334
4364
* `InteractHapticsUsed` - Emitted when the haptics are from a use.
@@ -4345,6 +4375,28 @@ Adding the `VRTK_InteractHaptics_UnityEvents` component to `VRTK_InteractHaptics
[Tooltip("Denotes the audio clip to use to rumble the controller on near touch.")]
31
+
publicAudioClipclipOnNearTouch;
32
+
[Tooltip("Denotes how strong the rumble in the controller will be on near touch.")]
33
+
[Range(0,1)]
34
+
publicfloatstrengthOnNearTouch=0;
35
+
[Tooltip("Denotes how long the rumble in the controller will last on near touch.")]
36
+
publicfloatdurationOnNearTouch=0f;
37
+
[Tooltip("Denotes interval betweens rumble in the controller on near touch.")]
38
+
publicfloatintervalOnNearTouch=minInterval;
39
+
40
+
[Header("Haptics On Touch Settings")]
29
41
30
42
[Tooltip("Denotes the audio clip to use to rumble the controller on touch.")]
31
43
publicAudioClipclipOnTouch;
@@ -37,7 +49,7 @@ public class VRTK_InteractHaptics : MonoBehaviour
37
49
[Tooltip("Denotes interval betweens rumble in the controller on touch.")]
38
50
publicfloatintervalOnTouch=minInterval;
39
51
40
-
[Header("Haptics On Grab")]
52
+
[Header("Haptics On Grab Settings")]
41
53
42
54
[Tooltip("Denotes the audio clip to use to rumble the controller on grab.")]
43
55
publicAudioClipclipOnGrab;
@@ -49,7 +61,7 @@ public class VRTK_InteractHaptics : MonoBehaviour
49
61
[Tooltip("Denotes interval betweens rumble in the controller on grab.")]
50
62
publicfloatintervalOnGrab=minInterval;
51
63
52
-
[Header("Haptics On Use")]
64
+
[Header("Haptics On Use Settings")]
53
65
54
66
[Tooltip("Denotes the audio clip to use to rumble the controller on use.")]
55
67
publicAudioClipclipOnUse;
@@ -61,6 +73,15 @@ public class VRTK_InteractHaptics : MonoBehaviour
61
73
[Tooltip("Denotes interval betweens rumble in the controller on use.")]
62
74
publicfloatintervalOnUse=minInterval;
63
75
76
+
[Header("Custom Settings")]
77
+
78
+
[Tooltip("The Interactable Object to initiate the haptics from. If this is left blank, then the Interactable Object will need to be on the current or a parent GameObject.")]
79
+
publicVRTK_InteractableObjectobjectToAffect;
80
+
81
+
/// <summary>
82
+
/// Emitted when the haptics are from a near touch.
VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT,"VRTK_InteractHaptics","VRTK_InteractableObject","the same or parent"));
0 commit comments