AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
WidgetDragInputHandler.cs
Go to the documentation of this file.
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
5 
6 public class WidgetDragInputHandler : MonoBehaviour, IInputClickHandler
7 {
8 
9  [SerializeField]
10  private GameObject widget;
11  private HandDraggable handDraggable;
12  //private bool isDraggable = false;
13 
14  // Use this for initialization
15  void Start()
16  {
17  handDraggable = widget.GetComponent<HandDraggable>();
18 
19  // Dragging is off by default
20  handDraggable.enabled = false;
21 
22  // When finished dragging, handDraggable should be disabled
23  handDraggable.StoppedDragging += stopDragging;
24  }
25 
26  // Update is called once per frame
27  void Update()
28  {
29 
30  }
31 
32  private void stopDragging()
33  {
34  handDraggable.enabled = false;
35  }
36 
37  // On air tap, dragging should be enabled
38  public void OnInputClicked(InputClickedEventData eventData)
39  {
40  handDraggable.enabled = true;
41  }
42 }
Interface to implement to react to simple click input.
Action StoppedDragging
Event triggered when dragging stops.
void OnInputClicked(InputClickedEventData eventData)
Describes an input event that involves a tap.
Component that allows dragging an object with your hand on HoloLens. Dragging is done by calculating ...