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
;
4
using
HoloToolkit
.
Unity
.
InputModule
;
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
}
HoloToolkit.Unity.InputModule
Definition:
AnimatedCursor.cs:7
System
WidgetDragInputHandler
Definition:
WidgetDragInputHandler.cs:6
HoloToolkit.Unity.InputModule.IInputClickHandler
Interface to implement to react to simple click input.
Definition:
IInputClickHandler.cs:11
HoloToolkit.Unity.InputModule.HandDraggable.StoppedDragging
Action StoppedDragging
Event triggered when dragging stops.
Definition:
HandDraggable.cs:24
WidgetDragInputHandler.OnInputClicked
void OnInputClicked(InputClickedEventData eventData)
Definition:
WidgetDragInputHandler.cs:38
HoloToolkit.Unity.InputModule.InputClickedEventData
Describes an input event that involves a tap.
Definition:
InputClickedEventData.cs:11
HoloToolkit
HoloToolkit.Unity.InputModule.HandDraggable
Component that allows dragging an object with your hand on HoloLens. Dragging is done by calculating ...
Definition:
HandDraggable.cs:14
UnityEngine
HoloToolkit.Unity
Assets
Scripts
WidgetDragInputHandler.cs
Generated by
1.8.12