Interhaptics SDK for Unity 1.6
Loading...
Searching...
No Matches
HapticControlGUI.cs
Go to the documentation of this file.
1/* ​
2* Copyright (c) 2023 Go Touch VR SAS. All rights reserved. ​
3* ​
4*/
5
6using UnityEngine;
8
10{
11 public class HapticControlGUI : MonoBehaviour
12 {
13 [SerializeField]
14 private EventHapticManagerMobile eventHapticManagerMobile;
15 [SerializeField]
16 private EventHapticSource eventHapticSource;
17 [SerializeField]
18 private GameObject buttonPlay;
19 [SerializeField]
20 private GameObject buttonStop;
21
22 void Start()
23 {
24 buttonPlay.SetActive(true);
25 buttonStop.SetActive(false);
26 }
27
28 public void StartHaptics()
29 {
30 eventHapticManagerMobile.StopPlayingEventHapticSources();
31 eventHapticSource.PlayEventVibration();
32 }
33 public void StopHaptics()
34 {
35 eventHapticSource.Stop();
36 Interhaptics.Core.HAR.ClearActiveEvents();
37 }
38
39 void Update()
40 {
41 if (eventHapticSource == null) return;
42 if (eventHapticSource.isPlaying)
43 {
44 buttonPlay.SetActive(false);
45 buttonStop.SetActive(true);
46 }
47 else
48 {
49 buttonPlay.SetActive(true);
50 buttonStop.SetActive(false);
51 }
52 }
53 }
54
55}
Haptic source that plays a haptic effect when triggered by an event. Plays the haptic effect on the s...
override void Stop()
Stops the haptic effect on the specified body parts.
override void PlayEventVibration()
Method to start the coroutine from outside (if necessary). Plays the haptic effect after the vibratio...