-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtouch_screen_notes.txt
71 lines (25 loc) · 1.08 KB
/
touch_screen_notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
CaptureScript
-------------
int[] realWorldPoints = context.ProjectiveToWorld
exclude all points where y < rangeMin || y > rangeMax
export touchX,touchZ --> touchX, touchY
Unity Scripts
----------------
class SharedVertex
float unityX, unityY, touchX, touchY
class TouchEventManager
SharedVertex NW, SW, NE, SE // TODO this could probably be encoded as a trapezoid
float unityToTouchWidthRatio, unityToTouchHeightRatio
setNW(unityX, unityY, touchX, touchY):
setNE(unityX, unityY, touchX, touchY):
setSW(unityX, unityY, touchX, touchY):
setSE(unityX, unityY, touchX, touchY):
calibrateWithCurrentSharedVertices:
unityWidthDelta = NW.unityX - NE.unityX touchWidthDelta = NW.touchX - NE.touchX
touchHeightDelta = NW.touchY - SW.touchY
unityToTouchWidthRatio = unityWidthDelta / touchWidthDelta
unityToTouchHeightRatio = unityHeightDelta / touchHeightDelta
Callbacks (via OSC):
touchDown(touchX, touchY)
touchMoved(touchX, touchY)
touchEnd(touchX, touchY)