brilliantsole 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/README.md +16 -10
  2. package/assets/3d/anchor.glb +0 -0
  3. package/assets/3d/coin.glb +0 -0
  4. package/assets/3d/glasses.glb +0 -0
  5. package/assets/3d/rightHand.glb +0 -0
  6. package/assets/audio/bounceMedium.wav +0 -0
  7. package/assets/audio/bounceStrong.wav +0 -0
  8. package/assets/audio/bounceWeak.wav +0 -0
  9. package/assets/audio/coin.wav +0 -0
  10. package/assets/audio/getUp.wav +0 -0
  11. package/assets/audio/grab.wav +0 -0
  12. package/assets/audio/kick.wav +0 -0
  13. package/assets/audio/platterFadeIn old.wav +0 -0
  14. package/assets/audio/platterFadeIn.wav +0 -0
  15. package/assets/audio/platterFadeOut.wav +0 -0
  16. package/assets/audio/punch.wav +0 -0
  17. package/assets/audio/punchSqueak.wav +0 -0
  18. package/assets/audio/purr.wav +0 -0
  19. package/assets/audio/purrFadeOut.wav +0 -0
  20. package/assets/audio/release.wav +0 -0
  21. package/assets/audio/splat.wav +0 -0
  22. package/assets/audio/stomp.wav +0 -0
  23. package/assets/images/ukaton-pressure-0.svg +9 -0
  24. package/assets/images/ukaton-pressure-1.svg +9 -0
  25. package/assets/images/ukaton-pressure-10.svg +9 -0
  26. package/assets/images/ukaton-pressure-11.svg +9 -0
  27. package/assets/images/ukaton-pressure-12.svg +9 -0
  28. package/assets/images/ukaton-pressure-13.svg +9 -0
  29. package/assets/images/ukaton-pressure-14.svg +9 -0
  30. package/assets/images/ukaton-pressure-15.svg +9 -0
  31. package/assets/images/ukaton-pressure-2.svg +9 -0
  32. package/assets/images/ukaton-pressure-3.svg +9 -0
  33. package/assets/images/ukaton-pressure-4.svg +9 -0
  34. package/assets/images/ukaton-pressure-5.svg +9 -0
  35. package/assets/images/ukaton-pressure-6.svg +9 -0
  36. package/assets/images/ukaton-pressure-7.svg +9 -0
  37. package/assets/images/ukaton-pressure-8.svg +9 -0
  38. package/assets/images/ukaton-pressure-9.svg +9 -0
  39. package/assets/images/ukaton-right-insole.svg +798 -0
  40. package/build/brilliantsole.cjs +2870 -882
  41. package/build/brilliantsole.cjs.map +1 -1
  42. package/build/brilliantsole.js +2477 -782
  43. package/build/brilliantsole.js.map +1 -1
  44. package/build/brilliantsole.ls.js +2260 -592
  45. package/build/brilliantsole.ls.js.map +1 -1
  46. package/build/brilliantsole.min.js +1 -1
  47. package/build/brilliantsole.min.js.map +1 -1
  48. package/build/brilliantsole.module.d.ts +302 -116
  49. package/build/brilliantsole.module.js +2468 -782
  50. package/build/brilliantsole.module.js.map +1 -1
  51. package/build/brilliantsole.module.min.d.ts +302 -116
  52. package/build/brilliantsole.module.min.js +1 -1
  53. package/build/brilliantsole.module.min.js.map +1 -1
  54. package/build/brilliantsole.node.module.d.ts +295 -113
  55. package/build/brilliantsole.node.module.js +2860 -882
  56. package/build/brilliantsole.node.module.js.map +1 -1
  57. package/build/dts/BS-output.d.ts +10 -0
  58. package/build/dts/BS.d.ts +21 -9
  59. package/build/dts/CameraManager.d.ts +72 -0
  60. package/build/dts/Device.d.ts +53 -16
  61. package/build/dts/DeviceInformationManager.d.ts +4 -4
  62. package/build/dts/DeviceManager.d.ts +3 -0
  63. package/build/dts/FileTransferManager.d.ts +18 -8
  64. package/build/dts/InformationManager.d.ts +8 -5
  65. package/build/dts/TfliteManager.d.ts +22 -2
  66. package/build/dts/WifiManager.d.ts +61 -0
  67. package/build/dts/connection/BaseConnectionManager.d.ts +37 -3
  68. package/build/dts/connection/ClientConnectionManager.d.ts +11 -2
  69. package/build/dts/connection/bluetooth/BluetoothConnectionManager.d.ts +1 -0
  70. package/build/dts/connection/bluetooth/NobleConnectionManager.d.ts +3 -1
  71. package/build/dts/connection/bluetooth/WebBluetoothConnectionManager.d.ts +2 -0
  72. package/build/dts/connection/bluetooth/bluetoothUUIDs.d.ts +2 -2
  73. package/build/dts/connection/udp/UDPConnectionManager.d.ts +28 -0
  74. package/build/dts/connection/webSocket/WebSocketConnectionManager.d.ts +25 -0
  75. package/build/dts/devicePair/DevicePair.d.ts +14 -10
  76. package/build/dts/devicePair/DevicePairPressureSensorDataManager.d.ts +8 -4
  77. package/build/dts/devicePair/DevicePairSensorDataManager.d.ts +2 -2
  78. package/build/dts/scanner/BaseScanner.d.ts +4 -1
  79. package/build/dts/scanner/NobleScanner.d.ts +2 -1
  80. package/build/dts/sensor/MotionSensorDataManager.d.ts +5 -2
  81. package/build/dts/sensor/SensorDataManager.d.ts +5 -4
  82. package/build/dts/server/BaseClient.d.ts +6 -3
  83. package/build/dts/server/ServerUtils.d.ts +1 -1
  84. package/build/dts/server/websocket/WebSocketUtils.d.ts +1 -1
  85. package/build/dts/utils/CenterOfPressureHelper.d.ts +2 -2
  86. package/build/dts/utils/Console.d.ts +2 -0
  87. package/build/dts/utils/MathUtils.d.ts +2 -0
  88. package/build/dts/utils/ThrottleUtils.d.ts +2 -0
  89. package/build/dts/vibration/VibrationManager.d.ts +19 -2
  90. package/build/index.d.ts +299 -113
  91. package/build/index.node.d.ts +292 -110
  92. package/examples/3d/scene.html +19 -5
  93. package/examples/3d/script.js +90 -17
  94. package/examples/3d-generic/index.html +144 -0
  95. package/examples/3d-generic/script.js +266 -0
  96. package/examples/balance/script.js +2 -1
  97. package/examples/basic/index.html +232 -18
  98. package/examples/basic/script.js +746 -106
  99. package/examples/bottango/index.html +11 -1
  100. package/examples/bottango/script.js +2 -2
  101. package/examples/center-of-pressure/index.html +114 -114
  102. package/examples/center-of-pressure/script.js +1 -1
  103. package/examples/device-pair/index.html +58 -58
  104. package/examples/device-pair/script.js +12 -8
  105. package/examples/edge-impulse/script.js +135 -44
  106. package/examples/edge-impulse-test/README.md +11 -0
  107. package/examples/edge-impulse-test/edge-impulse-standalone.js +7228 -0
  108. package/examples/edge-impulse-test/edge-impulse-standalone.wasm +0 -0
  109. package/examples/edge-impulse-test/index.html +75 -0
  110. package/examples/edge-impulse-test/run-impulse.js +135 -0
  111. package/examples/edge-impulse-test/script.js +200 -0
  112. package/examples/gloves/edge-impulse-standalone.js +7228 -0
  113. package/examples/gloves/edge-impulse-standalone.wasm +0 -0
  114. package/examples/gloves/index.html +119 -0
  115. package/examples/gloves/run-impulse.js +135 -0
  116. package/examples/gloves/scene.html +124 -0
  117. package/examples/gloves/script.js +931 -0
  118. package/examples/graph/index.html +11 -1
  119. package/examples/graph/script.js +94 -37
  120. package/examples/pressure/index.html +180 -12
  121. package/examples/pressure/script.js +144 -7
  122. package/examples/punch/index.html +135 -0
  123. package/examples/punch/punch.tflite +0 -0
  124. package/examples/punch/script.js +169 -0
  125. package/examples/recording/index.html +191 -183
  126. package/examples/server/index.html +109 -23
  127. package/examples/server/script.js +322 -111
  128. package/examples/ukaton-firmware-update/index.html +20 -0
  129. package/examples/ukaton-firmware-update/manifest.json +11 -0
  130. package/examples/ukaton-firmware-update/merged-firmware.bin +0 -0
  131. package/examples/utils/aframe/aframe-master.min.js +2 -0
  132. package/examples/utils/aframe/bs-vibration.js +150 -0
  133. package/examples/utils/aframe/force-pushable.js +80 -0
  134. package/examples/utils/aframe/grabbable-anchor.js +46 -0
  135. package/examples/utils/aframe/grabbable-listener.js +31 -0
  136. package/examples/utils/aframe/grabbable-physics-body.js +190 -0
  137. package/examples/utils/aframe/grow-shrink.js +25 -0
  138. package/examples/utils/aframe/hand-punch.js +119 -0
  139. package/examples/utils/aframe/my-obb-collider.js +293 -0
  140. package/examples/utils/aframe/occlude-hand-tracking-controls.js +47 -0
  141. package/examples/utils/aframe/occlude-mesh.js +42 -0
  142. package/examples/utils/aframe/palm-up-detector.js +47 -0
  143. package/examples/utils/aframe/shadow-material.js +20 -0
  144. package/examples/utils/aframe/soft-shadow-light.js +9 -0
  145. package/examples/webxr/script.js +3 -3
  146. package/examples/webxr-2/assets/3d/soccerBall.glb +0 -0
  147. package/examples/webxr-2/assets/audio/shellBounce.wav +0 -0
  148. package/examples/webxr-2/assets/audio/shellHit.wav +0 -0
  149. package/examples/webxr-2/assets/audio/shellKick.wav +0 -0
  150. package/examples/webxr-2/assets/audio/soccerBounce.wav +0 -0
  151. package/examples/webxr-2/assets/audio/soccerKick.mp3 +0 -0
  152. package/examples/webxr-2/assets/images/shellTexture.png +0 -0
  153. package/examples/webxr-2/components/bs-ankle.js +337 -0
  154. package/examples/webxr-2/components/coin.js +84 -0
  155. package/examples/webxr-2/components/custom-wrap.js +17 -0
  156. package/examples/webxr-2/components/goomba.js +3250 -0
  157. package/examples/webxr-2/components/init-shell-material.js +215 -0
  158. package/examples/webxr-2/components/platter.js +172 -0
  159. package/examples/webxr-2/components/shell.js +374 -0
  160. package/examples/webxr-2/components/soccer-ball.js +250 -0
  161. package/examples/webxr-2/components/squashed-goomba.js +249 -0
  162. package/examples/webxr-2/edge-impulse-standalone.js +7228 -0
  163. package/examples/webxr-2/edge-impulse-standalone.wasm +0 -0
  164. package/examples/webxr-2/index.html +996 -0
  165. package/examples/webxr-2/kick.tflite +0 -0
  166. package/examples/webxr-2/kick2.tflite +0 -0
  167. package/examples/webxr-2/run-impulse.js +135 -0
  168. package/examples/webxr-2/script.js +384 -0
  169. package/package.json +2 -1
  170. package/src/.prettierrc +4 -0
  171. package/src/BS.ts +66 -9
  172. package/src/CameraManager.ts +499 -0
  173. package/src/Device.ts +620 -92
  174. package/src/DeviceInformationManager.ts +22 -11
  175. package/src/DeviceManager.ts +94 -25
  176. package/src/FileTransferManager.ts +146 -21
  177. package/src/FirmwareManager.ts +1 -1
  178. package/src/InformationManager.ts +62 -20
  179. package/src/TfliteManager.ts +172 -26
  180. package/src/WifiManager.ts +323 -0
  181. package/src/connection/BaseConnectionManager.ts +145 -30
  182. package/src/connection/ClientConnectionManager.ts +47 -11
  183. package/src/connection/bluetooth/BluetoothConnectionManager.ts +14 -3
  184. package/src/connection/bluetooth/NobleConnectionManager.ts +155 -42
  185. package/src/connection/bluetooth/WebBluetoothConnectionManager.ts +104 -35
  186. package/src/connection/bluetooth/bluetoothUUIDs.ts +40 -13
  187. package/src/connection/udp/UDPConnectionManager.ts +356 -0
  188. package/src/connection/websocket/WebSocketConnectionManager.ts +282 -0
  189. package/src/devicePair/DevicePair.ts +145 -49
  190. package/src/devicePair/DevicePairPressureSensorDataManager.ts +72 -24
  191. package/src/devicePair/DevicePairSensorDataManager.ts +5 -5
  192. package/src/scanner/BaseScanner.ts +49 -11
  193. package/src/scanner/NobleScanner.ts +81 -17
  194. package/src/sensor/BarometerSensorDataManager.ts +1 -1
  195. package/src/sensor/MotionSensorDataManager.ts +22 -7
  196. package/src/sensor/PressureSensorDataManager.ts +47 -13
  197. package/src/sensor/SensorConfigurationManager.ts +75 -24
  198. package/src/sensor/SensorDataManager.ts +107 -26
  199. package/src/server/BaseClient.ts +192 -37
  200. package/src/server/BaseServer.ts +201 -43
  201. package/src/server/ServerUtils.ts +39 -9
  202. package/src/server/udp/UDPServer.ts +74 -23
  203. package/src/server/udp/UDPUtils.ts +9 -2
  204. package/src/server/websocket/WebSocketClient.ts +30 -9
  205. package/src/server/websocket/WebSocketServer.ts +1 -1
  206. package/src/server/websocket/WebSocketUtils.ts +4 -2
  207. package/src/utils/CenterOfPressureHelper.ts +5 -5
  208. package/src/utils/Console.ts +62 -9
  209. package/src/utils/MathUtils.ts +31 -1
  210. package/src/utils/ParseUtils.ts +25 -6
  211. package/src/utils/ThrottleUtils.ts +62 -0
  212. package/src/utils/Timer.ts +1 -1
  213. package/src/utils/checksum.ts +1 -1
  214. package/src/utils/mcumgr.js +1 -1
  215. package/src/vibration/VibrationManager.ts +166 -40
@@ -0,0 +1,119 @@
1
+ <html>
2
+ <head>
3
+ <title>Gloves | BrilliantSole JavaScript SDK</title>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
5
+ <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
6
+ <!-- <script src="https://aframe.io/releases/1.5.0/aframe.min.js"></script> -->
7
+ <script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
8
+ <!-- required to get aframe-orbit-controls-component to work -->
9
+ <script>
10
+ THREE.Quaternion.prototype.inverse = THREE.Quaternion.prototype.invert;
11
+ THREE.Math = THREE.MathUtils;
12
+ </script>
13
+ <!-- https://github.com/tizzle/aframe-orbit-controls-component -->
14
+ <script src="https://cdn.rawgit.com/tizzle/aframe-orbit-controls-component/v0.1.14/dist/aframe-orbit-controls-component.min.js"></script>
15
+ <script src="edge-impulse-standalone.js"></script>
16
+ <script src="run-impulse.js"></script>
17
+ <script type="module" src="./script.js"></script>
18
+ </head>
19
+
20
+ <style>
21
+ #gloves {
22
+ display: flex;
23
+ flex-direction: row;
24
+ height: 100%;
25
+ gap: 0.5rem;
26
+ }
27
+ .glove {
28
+ position: relative;
29
+ height: 100%;
30
+ min-width: 700px;
31
+ flex: 1;
32
+ }
33
+
34
+ .scene {
35
+ width: 100%;
36
+ height: 100%;
37
+ margin: auto;
38
+ border-radius: 2rem;
39
+ overflow: hidden;
40
+ border: solid black;
41
+ box-sizing: border-box;
42
+ }
43
+
44
+ .scene iframe {
45
+ width: 100%;
46
+ height: 100%;
47
+ border: none;
48
+ }
49
+ </style>
50
+
51
+ <body>
52
+ <nav>
53
+ <a href="../../">home</a>
54
+ </nav>
55
+
56
+ <h1>Gloves | BrilliantSole JavaScript SDK</h1>
57
+
58
+ <button id="toggleServerConnection">connect to server</button>
59
+
60
+ <div>
61
+ <h2>available devices</h2>
62
+ <div id="availableDevices">
63
+ <template id="availableDeviceTemplate">
64
+ <div class="availableDevice">
65
+ <ul>
66
+ <li><b>name: </b> <span class="name"></span></li>
67
+ <li><b>type: </b> <span class="type"></span></li>
68
+ <li><button class="toggleConnection">connect</button></li>
69
+ </ul>
70
+ </div>
71
+ </template>
72
+ </div>
73
+ </div>
74
+
75
+ <p>
76
+ <button id="addDevice">add device</button>
77
+ </p>
78
+
79
+ <div id="gloves"></div>
80
+
81
+ <template id="gloveTemplate">
82
+ <div class="glove">
83
+ <p>
84
+ <button class="toggleConnection" disabled>disconnect</button>
85
+ <br />
86
+ <select class="orientation" disabled>
87
+ <optgroup label="orientation">
88
+ <option value="none">no orientation</option>
89
+ <option>gameRotation</option>
90
+ <option>rotation</option>
91
+ <option>orientation</option>
92
+ <option>gyroscope</option>
93
+ </optgroup>
94
+ </select>
95
+ <button disabled class="resetOrientation">reset orientation</button>
96
+ <br />
97
+ <select class="position" disabled>
98
+ <optgroup label="position">
99
+ <option value="none">no position</option>
100
+ <option>acceleration</option>
101
+ <option>gravity</option>
102
+ <option>linearAcceleration</option>
103
+ </optgroup>
104
+ </select>
105
+ <br />
106
+ <button disabled class="togglePressure">enable pressure</button>
107
+ <button disabled class="resetPressure">reset pressure</button>
108
+ <br />
109
+ <button class="toggleCursor">enable cursor</button>
110
+ <button class="resetCursor">reset</button>
111
+ <br />
112
+ </p>
113
+ <div class="scene">
114
+ <iframe src="./scene.html"></iframe>
115
+ </div>
116
+ </div>
117
+ </template>
118
+ </body>
119
+ </html>
@@ -0,0 +1,135 @@
1
+ // Classifier module
2
+ let classifierInitialized = false;
3
+ Module.onRuntimeInitialized = function() {
4
+ classifierInitialized = true;
5
+ };
6
+
7
+ class EdgeImpulseClassifier {
8
+ _initialized = false;
9
+
10
+ init() {
11
+ if (classifierInitialized === true) return Promise.resolve();
12
+
13
+ return new Promise((resolve) => {
14
+ Module.onRuntimeInitialized = () => {
15
+ classifierInitialized = true;
16
+ Module.init();
17
+ resolve();
18
+ };
19
+ });
20
+ }
21
+
22
+ getProjectInfo() {
23
+ if (!classifierInitialized) throw new Error('Module is not initialized');
24
+ return this._convertToOrdinaryJsObject(Module.get_project(), Module.emcc_classification_project_t.prototype);
25
+ }
26
+
27
+ classify(rawData, debug = false) {
28
+ if (!classifierInitialized) throw new Error('Module is not initialized');
29
+
30
+ const obj = this._arrayToHeap(rawData);
31
+ let ret = Module.run_classifier(obj.buffer.byteOffset, rawData.length, debug);
32
+ Module._free(obj.ptr);
33
+
34
+ if (ret.result !== 0) {
35
+ throw new Error('Classification failed (err code: ' + ret.result + ')');
36
+ }
37
+
38
+ return this._fillResultStruct(ret);
39
+ }
40
+
41
+ classifyContinuous(rawData, enablePerfCal = true) {
42
+ if (!classifierInitialized) throw new Error('Module is not initialized');
43
+
44
+ const obj = this._arrayToHeap(rawData);
45
+ let ret = Module.run_classifier_continuous(obj.buffer.byteOffset, rawData.length, false, enablePerfCal);
46
+ Module._free(obj.ptr);
47
+
48
+ if (ret.result !== 0) {
49
+ throw new Error('Classification failed (err code: ' + ret.result + ')');
50
+ }
51
+
52
+ return this._fillResultStruct(ret);
53
+ }
54
+
55
+ getProperties() {
56
+ if (!classifierInitialized) throw new Error('Module is not initialized');
57
+ return this._convertToOrdinaryJsObject(Module.get_properties(), Module.emcc_classification_properties_t.prototype);
58
+ }
59
+
60
+ /**
61
+ * Override the threshold on a learn block (you can find thresholds via getProperties().thresholds)
62
+ * @param {*} obj, e.g. { id: 16, min_score: 0.2 } to set min. object detection threshold to 0.2 for block ID 16
63
+ */
64
+ setThreshold(obj) {
65
+ const ret = Module.set_threshold(obj);
66
+ if (!ret.success) {
67
+ throw new Error(ret.error);
68
+ }
69
+ }
70
+
71
+ _arrayToHeap(data) {
72
+ let typedArray = new Float32Array(data);
73
+ let numBytes = typedArray.length * typedArray.BYTES_PER_ELEMENT;
74
+ let ptr = Module._malloc(numBytes);
75
+ let heapBytes = new Uint8Array(Module.HEAPU8.buffer, ptr, numBytes);
76
+ heapBytes.set(new Uint8Array(typedArray.buffer));
77
+ return { ptr: ptr, buffer: heapBytes };
78
+ }
79
+
80
+ _convertToOrdinaryJsObject(emboundObj, prototype) {
81
+ let newObj = { };
82
+ for (const key of Object.getOwnPropertyNames(prototype)) {
83
+ const descriptor = Object.getOwnPropertyDescriptor(prototype, key);
84
+
85
+ if (descriptor && typeof descriptor.get === 'function') {
86
+ newObj[key] = emboundObj[key]; // Evaluates the getter and assigns as an own property.
87
+ }
88
+ }
89
+ return newObj;
90
+ }
91
+
92
+ _fillResultStruct(ret) {
93
+ let props = Module.get_properties();
94
+
95
+ let jsResult = {
96
+ anomaly: ret.anomaly,
97
+ results: []
98
+ };
99
+
100
+ for (let cx = 0; cx < ret.size(); cx++) {
101
+ let c = ret.get(cx);
102
+ if (props.model_type === 'object_detection' || props.model_type === 'constrained_object_detection') {
103
+ jsResult.results.push({ label: c.label, value: c.value, x: c.x, y: c.y, width: c.width, height: c.height });
104
+ }
105
+ else {
106
+ jsResult.results.push({ label: c.label, value: c.value });
107
+ }
108
+ c.delete();
109
+ }
110
+
111
+ if (props.has_object_tracking) {
112
+ jsResult.object_tracking_results = [];
113
+ for (let cx = 0; cx < ret.object_tracking_size(); cx++) {
114
+ let c = ret.object_tracking_get(cx);
115
+ jsResult.object_tracking_results.push({ object_id: c.object_id, label: c.label, value: c.value, x: c.x, y: c.y, width: c.width, height: c.height });
116
+ c.delete();
117
+ }
118
+ }
119
+
120
+ if (props.has_visual_anomaly_detection) {
121
+ jsResult.visual_ad_max = ret.visual_ad_max;
122
+ jsResult.visual_ad_mean = ret.visual_ad_mean;
123
+ jsResult.visual_ad_grid_cells = [];
124
+ for (let cx = 0; cx < ret.visual_ad_grid_cells_size(); cx++) {
125
+ let c = ret.visual_ad_grid_cells_get(cx);
126
+ jsResult.visual_ad_grid_cells.push({ label: c.label, value: c.value, x: c.x, y: c.y, width: c.width, height: c.height });
127
+ c.delete();
128
+ }
129
+ }
130
+
131
+ ret.delete();
132
+
133
+ return jsResult;
134
+ }
135
+ }
@@ -0,0 +1,124 @@
1
+ <html>
2
+ <head>
3
+ <title>3D iframe | BrilliantSole JavaScript SDK</title>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
5
+ <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
6
+ <!-- <script src="https://aframe.io/releases/1.5.0/aframe.min.js"></script> -->
7
+ <script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
8
+ <!-- required to get aframe-orbit-controls-component to work -->
9
+ <script>
10
+ THREE.Quaternion.prototype.inverse = THREE.Quaternion.prototype.invert;
11
+ THREE.Math = THREE.MathUtils;
12
+ </script>
13
+ <!-- https://github.com/tizzle/aframe-orbit-controls-component -->
14
+ <script src="https://cdn.rawgit.com/tizzle/aframe-orbit-controls-component/v0.1.14/dist/aframe-orbit-controls-component.min.js"></script>
15
+ <!-- https://github.com/c-frame/aframe-physics-system/blob/master/CannonDriver.md#installation -->
16
+ <script src="https://cdn.jsdelivr.net/gh/c-frame/aframe-physics-system@v4.2.2/dist/aframe-physics-system.min.js"></script>
17
+ </head>
18
+
19
+ <style>
20
+ body {
21
+ margin: 0;
22
+ }
23
+ </style>
24
+
25
+ <body>
26
+ <a-scene
27
+ physics="debug: false"
28
+ embedded
29
+ xr-mode-ui="enabled: false;"
30
+ device-orientation-permission-ui="enabled: false"
31
+ renderer="colorManagement: true;"
32
+ >
33
+ <a-assets>
34
+ <a-asset-item id="rightHand" src="../../assets/3d/rightHand.glb"></a-asset-item>
35
+ </a-assets>
36
+ <a-light type="directional" position="2 2 -2" target=".target"></a-light>
37
+ <a-light type="directional" position="-2 2 2" target=".target"></a-light>
38
+ <a-light type="directional" position="2 -2 2" target=".target"></a-light>
39
+
40
+ <a-camera
41
+ class="camera"
42
+ camera="fov: 50; zoom: 3.2; active: true; "
43
+ position="0 1 0"
44
+ orbit-controls="
45
+ enableZoom: true;
46
+ autoRotate: false;
47
+ enabled: true;
48
+ target: .target;
49
+ enableDamping: true;
50
+ dampingFactor: 0.125;
51
+ rotateSpeed:0.25;
52
+ minDistance:0.75;
53
+ maxDistance:2;
54
+ "
55
+ ></a-camera>
56
+
57
+ <a-sky></a-sky>
58
+
59
+ <a-camera
60
+ class="cursorCamera"
61
+ camera="fov: 50; zoom: 3.2; active: false;"
62
+ look-controls="enabled: false"
63
+ position="0 0 0"
64
+ wasd-controls-enabled="false"
65
+ ></a-camera>
66
+ <a-entity class="cursorExample" visible="false">
67
+ <a-entity class="cursor" position="0 0 -1">
68
+ <a-cylinder
69
+ class="mesh"
70
+ material="shader: flat;"
71
+ color="lightgreen"
72
+ data-color="lightgreen"
73
+ scale="1 1 1"
74
+ radius="0.005"
75
+ height="0.001"
76
+ rotation="90 0 0"
77
+ ></a-cylinder>
78
+ </a-entity>
79
+ <a-box color="blue" dynamic-body data-color="blue" position="0 1 -20" class="intersectable"></a-box>
80
+ <a-sphere
81
+ class="cursorHandle"
82
+ radius="0.1"
83
+ visible="false"
84
+ position="1 1 -20"
85
+ static-body
86
+ color="red"
87
+ ></a-sphere>
88
+ <a-plane static-body rotation="-90 0 0" width="100" height="100" position="0 -1 0" color="lightgrey"></a-plane>
89
+ </a-entity>
90
+
91
+ <a-entity class="target" visible="false">
92
+ <a-entity class="rotation">
93
+ <a-entity class="position" position="0 0 0">
94
+ <a-entity class="glove" gltf-model="#rightHand" visible="true" scale="0.05 0.05 0.05"></a-entity>
95
+ <a-entity data-pressure="5" position="-0.02739 0.00949 -0.04775" visible="false">
96
+ <a-sphere color="red" radius="0.007"></a-sphere>
97
+ </a-entity>
98
+ <a-entity data-pressure="2" position="-0.00608 0.0113 -0.04775">
99
+ <a-sphere color="red" radius="0.007"></a-sphere>
100
+ </a-entity>
101
+ <a-entity data-pressure="0" visible="false" position="0.01241 0.00847 -0.04775">
102
+ <a-sphere color="red" radius="0.007"></a-sphere>
103
+ </a-entity>
104
+ <a-entity data-pressure="3" position="0.03039 0.0069 -0.03797">
105
+ <a-sphere color="red" radius="0.007"></a-sphere>
106
+ </a-entity>
107
+ <a-entity data-pressure="4" position="-0.02686 -0.00286 -0.04734">
108
+ <a-sphere color="red" radius="0.007"></a-sphere>
109
+ </a-entity>
110
+ <a-entity data-pressure="7" position="0.01145 -0.00286 -0.04734">
111
+ <a-sphere color="red" radius="0.007"></a-sphere>
112
+ </a-entity>
113
+ <a-entity data-pressure="6" position="-0.0447 -0.01594 -0.01474">
114
+ <a-sphere color="red" radius="0.007"></a-sphere>
115
+ </a-entity>
116
+ <a-entity data-pressure="1" position="0.00673 -0.00835 -0.00116">
117
+ <a-sphere color="red" radius="0.007"></a-sphere>
118
+ </a-entity>
119
+ </a-entity>
120
+ </a-entity>
121
+ </a-entity>
122
+ </a-scene>
123
+ </body>
124
+ </html>