matrix-engine-wgpu 1.3.16 → 1.3.18

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 (273) hide show
  1. package/.codesandbox/tasks.json +46 -0
  2. package/.devcontainer/devcontainer.json +22 -0
  3. package/.github/dependabot.yml +12 -0
  4. package/REFERENCE.md +59 -0
  5. package/app-worker.js +45 -0
  6. package/dev.md +541 -0
  7. package/empty.js +17 -0
  8. package/examples/camera-texture.js +60 -0
  9. package/examples/games/jamb/html-content.js +128 -0
  10. package/examples/games/jamb/jamb.js +1341 -0
  11. package/examples/games/jamb/readme.md +3 -0
  12. package/examples/load-jamb.js +6 -0
  13. package/examples/load-obj-file.js +95 -0
  14. package/examples/load-objs-sequence.js +68 -0
  15. package/examples/unlit-textures.js +31 -0
  16. package/examples/video-texture.js +61 -0
  17. package/examples.js +73 -0
  18. package/main.js +635 -0
  19. package/non-project-files/cubebuffer-example.js +51 -0
  20. package/non-project-files/dev.txt +21 -0
  21. package/non-project-files/image1.png +0 -0
  22. package/non-project-files/image6.png +0 -0
  23. package/package.json +2 -5
  24. package/public/ammojs/ammo.js +957 -0
  25. package/public/ammojs/ammo.wasm.js +921 -0
  26. package/public/ammojs/ammo.wasm.wasm +0 -0
  27. package/public/app-worker.js +47 -0
  28. package/public/app.js +12744 -0
  29. package/public/css/style.css +711 -0
  30. package/public/empty.html +25 -0
  31. package/public/empty.js +10453 -0
  32. package/public/examples.html +30 -0
  33. package/public/examples.js +11217 -0
  34. package/public/index.html +20 -0
  35. package/public/manifest copy.web +35 -0
  36. package/public/manifest.web +25 -0
  37. package/public/res/audios/block.mp3 +0 -0
  38. package/public/res/audios/dice-roll.mp3 +0 -0
  39. package/public/res/audios/dice1.mp3 +0 -0
  40. package/public/res/audios/dice2.mp3 +0 -0
  41. package/public/res/audios/kenney/Kenney.url +2 -0
  42. package/public/res/audios/kenney/License.txt +22 -0
  43. package/public/res/audios/kenney/Patreon.url +2 -0
  44. package/public/res/audios/kenney/audios/back_001.ogg +0 -0
  45. package/public/res/audios/kenney/audios/back_002.ogg +0 -0
  46. package/public/res/audios/kenney/audios/back_003.ogg +0 -0
  47. package/public/res/audios/kenney/audios/back_004.ogg +0 -0
  48. package/public/res/audios/kenney/audios/bong_001.ogg +0 -0
  49. package/public/res/audios/kenney/audios/click_001.ogg +0 -0
  50. package/public/res/audios/kenney/audios/click_002.ogg +0 -0
  51. package/public/res/audios/kenney/audios/click_003.ogg +0 -0
  52. package/public/res/audios/kenney/audios/click_004.ogg +0 -0
  53. package/public/res/audios/kenney/audios/click_005.ogg +0 -0
  54. package/public/res/audios/kenney/audios/close_001.ogg +0 -0
  55. package/public/res/audios/kenney/audios/close_002.ogg +0 -0
  56. package/public/res/audios/kenney/audios/close_003.ogg +0 -0
  57. package/public/res/audios/kenney/audios/close_004.ogg +0 -0
  58. package/public/res/audios/kenney/audios/confirmation_001.ogg +0 -0
  59. package/public/res/audios/kenney/audios/confirmation_002.ogg +0 -0
  60. package/public/res/audios/kenney/audios/confirmation_003.ogg +0 -0
  61. package/public/res/audios/kenney/audios/confirmation_004.ogg +0 -0
  62. package/public/res/audios/kenney/audios/drop_001.ogg +0 -0
  63. package/public/res/audios/kenney/audios/drop_002.ogg +0 -0
  64. package/public/res/audios/kenney/audios/drop_003.ogg +0 -0
  65. package/public/res/audios/kenney/audios/drop_004.ogg +0 -0
  66. package/public/res/audios/kenney/audios/error_001.ogg +0 -0
  67. package/public/res/audios/kenney/audios/error_002.ogg +0 -0
  68. package/public/res/audios/kenney/audios/error_003.ogg +0 -0
  69. package/public/res/audios/kenney/audios/error_004.ogg +0 -0
  70. package/public/res/audios/kenney/audios/error_005.ogg +0 -0
  71. package/public/res/audios/kenney/audios/error_006.ogg +0 -0
  72. package/public/res/audios/kenney/audios/error_007.ogg +0 -0
  73. package/public/res/audios/kenney/audios/error_008.ogg +0 -0
  74. package/public/res/audios/kenney/audios/glass_001.ogg +0 -0
  75. package/public/res/audios/kenney/audios/glass_002.ogg +0 -0
  76. package/public/res/audios/kenney/audios/glass_003.ogg +0 -0
  77. package/public/res/audios/kenney/audios/glass_004.ogg +0 -0
  78. package/public/res/audios/kenney/audios/glass_005.ogg +0 -0
  79. package/public/res/audios/kenney/audios/glass_006.ogg +0 -0
  80. package/public/res/audios/kenney/audios/glitch_001.ogg +0 -0
  81. package/public/res/audios/kenney/audios/glitch_002.ogg +0 -0
  82. package/public/res/audios/kenney/audios/glitch_003.ogg +0 -0
  83. package/public/res/audios/kenney/audios/glitch_004.ogg +0 -0
  84. package/public/res/audios/kenney/audios/maximize_001.ogg +0 -0
  85. package/public/res/audios/kenney/audios/maximize_002.ogg +0 -0
  86. package/public/res/audios/kenney/audios/maximize_003.ogg +0 -0
  87. package/public/res/audios/kenney/audios/maximize_004.ogg +0 -0
  88. package/public/res/audios/kenney/audios/maximize_005.ogg +0 -0
  89. package/public/res/audios/kenney/audios/maximize_006.ogg +0 -0
  90. package/public/res/audios/kenney/audios/maximize_007.ogg +0 -0
  91. package/public/res/audios/kenney/audios/maximize_008.ogg +0 -0
  92. package/public/res/audios/kenney/audios/maximize_009.ogg +0 -0
  93. package/public/res/audios/kenney/audios/minimize_001.ogg +0 -0
  94. package/public/res/audios/kenney/audios/minimize_002.ogg +0 -0
  95. package/public/res/audios/kenney/audios/minimize_003.ogg +0 -0
  96. package/public/res/audios/kenney/audios/minimize_004.ogg +0 -0
  97. package/public/res/audios/kenney/audios/minimize_005.ogg +0 -0
  98. package/public/res/audios/kenney/audios/minimize_006.ogg +0 -0
  99. package/public/res/audios/kenney/audios/minimize_007.ogg +0 -0
  100. package/public/res/audios/kenney/audios/minimize_008.ogg +0 -0
  101. package/public/res/audios/kenney/audios/minimize_009.ogg +0 -0
  102. package/public/res/audios/kenney/audios/open_001.ogg +0 -0
  103. package/public/res/audios/kenney/audios/open_002.ogg +0 -0
  104. package/public/res/audios/kenney/audios/open_003.ogg +0 -0
  105. package/public/res/audios/kenney/audios/open_004.ogg +0 -0
  106. package/public/res/audios/kenney/audios/pluck_001.ogg +0 -0
  107. package/public/res/audios/kenney/audios/pluck_002.ogg +0 -0
  108. package/public/res/audios/kenney/audios/question_001.ogg +0 -0
  109. package/public/res/audios/kenney/audios/question_002.ogg +0 -0
  110. package/public/res/audios/kenney/audios/question_003.ogg +0 -0
  111. package/public/res/audios/kenney/audios/question_004.ogg +0 -0
  112. package/public/res/audios/kenney/audios/scratch_001.ogg +0 -0
  113. package/public/res/audios/kenney/audios/scratch_002.ogg +0 -0
  114. package/public/res/audios/kenney/audios/scratch_003.ogg +0 -0
  115. package/public/res/audios/kenney/audios/scratch_004.ogg +0 -0
  116. package/public/res/audios/kenney/audios/scratch_005.ogg +0 -0
  117. package/public/res/audios/kenney/audios/scroll_001.ogg +0 -0
  118. package/public/res/audios/kenney/audios/scroll_002.ogg +0 -0
  119. package/public/res/audios/kenney/audios/scroll_003.ogg +0 -0
  120. package/public/res/audios/kenney/audios/scroll_004.ogg +0 -0
  121. package/public/res/audios/kenney/audios/scroll_005.ogg +0 -0
  122. package/public/res/audios/kenney/audios/select_001.ogg +0 -0
  123. package/public/res/audios/kenney/audios/select_002.ogg +0 -0
  124. package/public/res/audios/kenney/audios/select_003.ogg +0 -0
  125. package/public/res/audios/kenney/audios/select_004.ogg +0 -0
  126. package/public/res/audios/kenney/audios/select_005.ogg +0 -0
  127. package/public/res/audios/kenney/audios/select_006.ogg +0 -0
  128. package/public/res/audios/kenney/audios/select_007.ogg +0 -0
  129. package/public/res/audios/kenney/audios/select_008.ogg +0 -0
  130. package/public/res/audios/kenney/audios/switch_001.ogg +0 -0
  131. package/public/res/audios/kenney/audios/switch_002.ogg +0 -0
  132. package/public/res/audios/kenney/audios/switch_003.ogg +0 -0
  133. package/public/res/audios/kenney/audios/switch_004.ogg +0 -0
  134. package/public/res/audios/kenney/audios/switch_005.ogg +0 -0
  135. package/public/res/audios/kenney/audios/switch_006.ogg +0 -0
  136. package/public/res/audios/kenney/audios/switch_007.ogg +0 -0
  137. package/public/res/audios/kenney/audios/tick_001.ogg +0 -0
  138. package/public/res/audios/kenney/audios/tick_002.ogg +0 -0
  139. package/public/res/audios/kenney/audios/tick_004.ogg +0 -0
  140. package/public/res/audios/kenney/audios/toggle_001.ogg +0 -0
  141. package/public/res/audios/kenney/audios/toggle_002.ogg +0 -0
  142. package/public/res/audios/kenney/audios/toggle_003.ogg +0 -0
  143. package/public/res/audios/kenney/audios/toggle_004.ogg +0 -0
  144. package/public/res/audios/start.mp3 +0 -0
  145. package/public/res/audios/toggle_002.mp3 +0 -0
  146. package/public/res/fonts/Accuratist.ttf +0 -0
  147. package/public/res/fonts/Closeness.ttf +0 -0
  148. package/public/res/fonts/WARGAMES.TTF +0 -0
  149. package/public/res/fonts/readme.txt +5 -0
  150. package/public/res/fonts/stormfaze.ttf +0 -0
  151. package/public/res/icons/512.png +0 -0
  152. package/public/res/icons/webgpu-horizontal.svg +45 -0
  153. package/public/res/meshes/blender/cube.blend +0 -0
  154. package/public/res/meshes/blender/cube.blend1 +0 -0
  155. package/public/res/meshes/blender/cube.mtl +12 -0
  156. package/public/res/meshes/blender/cube.obj +46 -0
  157. package/public/res/meshes/blender/cube.png +0 -0
  158. package/public/res/meshes/blender/cubeSmartUV.blend +0 -0
  159. package/public/res/meshes/blender/cubeSmartUV.mtl +12 -0
  160. package/public/res/meshes/blender/cubeSmartUV.obj +46 -0
  161. package/public/res/meshes/blender/lopta.mtl +10 -0
  162. package/public/res/meshes/blender/lopta.obj +3402 -0
  163. package/public/res/meshes/blender/piramyd.blend +0 -0
  164. package/public/res/meshes/blender/piramyd.blend1 +0 -0
  165. package/public/res/meshes/blender/piramyd.js +42 -0
  166. package/public/res/meshes/blender/piramyd.mtl +10 -0
  167. package/public/res/meshes/blender/piramyd.obj +18696 -0
  168. package/public/res/meshes/blender/piramyd1.js +42 -0
  169. package/public/res/meshes/blender/sphepe.blend +0 -0
  170. package/public/res/meshes/blender/sphepe.blend1 +0 -0
  171. package/public/res/meshes/blender/sphere.mtl +10 -0
  172. package/public/res/meshes/blender/sphere.obj +3402 -0
  173. package/public/res/meshes/blender/welcomeTextblend.blend +0 -0
  174. package/public/res/meshes/dragon/stanfordDragonData.js +5 -0
  175. package/public/res/meshes/jamb/bg.blend +0 -0
  176. package/public/res/meshes/jamb/bg.blend1 +0 -0
  177. package/public/res/meshes/jamb/bg.mtl +12 -0
  178. package/public/res/meshes/jamb/bg.obj +17 -0
  179. package/public/res/meshes/jamb/bg.png +0 -0
  180. package/public/res/meshes/jamb/dice-default.png +0 -0
  181. package/public/res/meshes/jamb/dice-mark.png +0 -0
  182. package/public/res/meshes/jamb/dice.mtl +12 -0
  183. package/public/res/meshes/jamb/dice.obj +40 -0
  184. package/public/res/meshes/jamb/dice.png +0 -0
  185. package/public/res/meshes/jamb/jamb-title.mtl +12 -0
  186. package/public/res/meshes/jamb/jamb-title.obj +26008 -0
  187. package/public/res/meshes/jamb/jamb.blend +0 -0
  188. package/public/res/meshes/jamb/jamb.blend1 +0 -0
  189. package/public/res/meshes/jamb/logo.png +0 -0
  190. package/public/res/meshes/jamb/nidzaDice.blend +0 -0
  191. package/public/res/meshes/jamb/nidzaDice.blend1 +0 -0
  192. package/public/res/meshes/jamb/pile.blend +0 -0
  193. package/public/res/meshes/jamb/simpleCube.blend +0 -0
  194. package/public/res/meshes/jamb/simpleCube.blend1 +0 -0
  195. package/public/res/meshes/jamb/sounds/roll1.wav +0 -0
  196. package/public/res/meshes/jamb/text.png +0 -0
  197. package/public/res/meshes/obj/armor.obj +319 -0
  198. package/public/res/meshes/obj/armor.png +0 -0
  199. package/public/res/meshes/objs-sequence/swat-walk-pistol_000001.mtl +22 -0
  200. package/public/res/meshes/objs-sequence/swat-walk-pistol_000001.obj +23264 -0
  201. package/public/res/meshes/objs-sequence/swat-walk-pistol_000002.mtl +22 -0
  202. package/public/res/meshes/objs-sequence/swat-walk-pistol_000002.obj +23261 -0
  203. package/public/res/meshes/objs-sequence/swat-walk-pistol_000003.mtl +22 -0
  204. package/public/res/meshes/objs-sequence/swat-walk-pistol_000003.obj +23264 -0
  205. package/public/res/meshes/objs-sequence/swat-walk-pistol_000004.mtl +22 -0
  206. package/public/res/meshes/objs-sequence/swat-walk-pistol_000004.obj +23261 -0
  207. package/public/res/meshes/objs-sequence/swat-walk-pistol_000005.mtl +22 -0
  208. package/public/res/meshes/objs-sequence/swat-walk-pistol_000005.obj +23261 -0
  209. package/public/res/meshes/objs-sequence/swat-walk-pistol_000006.mtl +22 -0
  210. package/public/res/meshes/objs-sequence/swat-walk-pistol_000006.obj +23261 -0
  211. package/public/res/meshes/objs-sequence/swat-walk-pistol_000007.mtl +22 -0
  212. package/public/res/meshes/objs-sequence/swat-walk-pistol_000007.obj +23264 -0
  213. package/public/res/meshes/objs-sequence/swat-walk-pistol_000008.mtl +22 -0
  214. package/public/res/meshes/objs-sequence/swat-walk-pistol_000008.obj +23263 -0
  215. package/public/res/meshes/objs-sequence/swat-walk-pistol_000009.mtl +22 -0
  216. package/public/res/meshes/objs-sequence/swat-walk-pistol_000009.obj +23264 -0
  217. package/public/res/meshes/objs-sequence/swat-walk-pistol_000010.mtl +22 -0
  218. package/public/res/meshes/objs-sequence/swat-walk-pistol_000010.obj +23260 -0
  219. package/public/res/meshes/objs-sequence/swat-walk-pistol_000011.mtl +22 -0
  220. package/public/res/meshes/objs-sequence/swat-walk-pistol_000011.obj +23262 -0
  221. package/public/res/meshes/objs-sequence/swat-walk-pistol_000012.mtl +22 -0
  222. package/public/res/meshes/objs-sequence/swat-walk-pistol_000012.obj +23262 -0
  223. package/public/res/meshes/objs-sequence/swat-walk-pistol_000013.mtl +22 -0
  224. package/public/res/meshes/objs-sequence/swat-walk-pistol_000013.obj +23263 -0
  225. package/public/res/meshes/objs-sequence/swat-walk-pistol_000014.mtl +22 -0
  226. package/public/res/meshes/objs-sequence/swat-walk-pistol_000014.obj +23262 -0
  227. package/public/res/meshes/objs-sequence/swat-walk-pistol_000015.mtl +22 -0
  228. package/public/res/meshes/objs-sequence/swat-walk-pistol_000015.obj +23263 -0
  229. package/public/res/meshes/objs-sequence/swat-walk-pistol_000016.mtl +22 -0
  230. package/public/res/meshes/objs-sequence/swat-walk-pistol_000016.obj +23264 -0
  231. package/public/res/meshes/objs-sequence/swat-walk-pistol_000017.mtl +22 -0
  232. package/public/res/meshes/objs-sequence/swat-walk-pistol_000017.obj +23263 -0
  233. package/public/res/meshes/objs-sequence/swat-walk-pistol_000018.mtl +22 -0
  234. package/public/res/meshes/objs-sequence/swat-walk-pistol_000018.obj +23261 -0
  235. package/public/res/meshes/objs-sequence/swat-walk-pistol_000019.mtl +22 -0
  236. package/public/res/meshes/objs-sequence/swat-walk-pistol_000019.obj +23263 -0
  237. package/public/res/meshes/objs-sequence/swat-walk-pistol_000020.mtl +22 -0
  238. package/public/res/meshes/objs-sequence/swat-walk-pistol_000020.obj +23261 -0
  239. package/public/res/meshes/shapes/star1.obj +60 -0
  240. package/public/res/multilang/en.json +39 -0
  241. package/public/res/multilang/sr.json +39 -0
  242. package/public/res/textures/default.png +0 -0
  243. package/public/res/textures/rust.jpg +0 -0
  244. package/public/res/textures/tex1.jpg +0 -0
  245. package/public/res/videos/readme.txt +2 -0
  246. package/public/res/videos/tunel.mp4 +0 -0
  247. package/public/test.html +636 -0
  248. package/public/three-test.js +165 -0
  249. package/public/worker.html +25 -0
  250. package/src/engine/ball.js +482 -0
  251. package/src/engine/cube.js +496 -0
  252. package/src/engine/engine.js +404 -0
  253. package/src/engine/final/adaptJSON1.js +53 -0
  254. package/src/engine/final/utils2.js +63 -0
  255. package/src/engine/lights.js +153 -0
  256. package/src/engine/loader-obj.js +473 -0
  257. package/src/engine/materials.js +295 -0
  258. package/src/engine/matrix-class.js +252 -0
  259. package/src/engine/mesh-obj.js +574 -0
  260. package/src/engine/raycast.js +218 -0
  261. package/src/engine/utils.js +881 -0
  262. package/src/libs/mat.js +0 -0
  263. package/src/multilang/lang.js +35 -0
  264. package/src/physics/matrix-ammo.js +363 -0
  265. package/src/shaders/fragment.video.wgsl.js +83 -0
  266. package/src/shaders/fragment.wgsl.js +75 -0
  267. package/src/shaders/shaders.js +51 -0
  268. package/src/shaders/standard-matrix-engine-shaders/standard-matrix-engine-fs.glsl +56 -0
  269. package/src/shaders/standard-matrix-engine-shaders/standard-matrix-engine-vs.glsl +75 -0
  270. package/src/shaders/vertex.wgsl.js +54 -0
  271. package/src/shaders/vertexShadow.wgsl.js +20 -0
  272. package/src/sounds/sounds.js +69 -0
  273. package/src/world.js +474 -0
package/main.js ADDED
@@ -0,0 +1,635 @@
1
+ import MatrixEngineWGPU from "./src/world.js";
2
+ import {downloadMeshes} from './src/engine/loader-obj.js';
3
+ import {byId, LOG_FUNNY, LOG_INFO, LOG_MATRIX, mb, randomFloatFromTo, randomIntFromTo} from "./src/engine/utils.js";
4
+ import {dices, myDom} from "./examples/games/jamb/jamb.js";
5
+ import {addRaycastListener, touchCoordinate, rayIntersectsSphere, getRayFromMouse} from "./src/engine/raycast.js";
6
+
7
+ export let application = new MatrixEngineWGPU({
8
+ useSingleRenderPass: true,
9
+ canvasSize: 'fullscreen',
10
+ mainCameraParams: {
11
+ type: 'WASD',
12
+ responseCoef: 1000
13
+ }
14
+ }, () => {
15
+ // Dom operations
16
+ application.userState = {
17
+ name: 'Guest',
18
+ points: 0
19
+ };
20
+ application.myDom = myDom;
21
+ myDom.createJamb();
22
+ myDom.addDraggerForTable();
23
+ myDom.createBlocker();
24
+ application.dices = dices;
25
+
26
+
27
+ application.activateDiceClickListener = null;
28
+
29
+ // -------------------------
30
+ // TEST
31
+ application.matrixAmmo.detectTopFaceFromQuat = (q) => {
32
+ // Define based on *visual face* → object-space normal mapping
33
+ const faces = [
34
+ {face: 1, vec: [0, 1, 0]}, // top
35
+ {face: 2, vec: [0, -1, 0]}, // bottom
36
+ {face: 3, vec: [0, 0, 1]}, // front
37
+ {face: 4, vec: [0, 0, -1]}, // back
38
+ {face: 5, vec: [1, 0, 0]}, // right
39
+ {face: 6, vec: [-1, 0, 0]} // left
40
+ ];
41
+
42
+ let maxDot = -Infinity;
43
+ let topFace = null;
44
+
45
+ for(const f of faces) {
46
+ const v = application.matrixAmmo.applyQuatToVec(q, f.vec);
47
+ const dot = v.y; // Compare with world up (0, 1, 0)
48
+ if(dot > maxDot) {
49
+ maxDot = dot;
50
+ topFace = f.face;
51
+ }
52
+ }
53
+
54
+ return topFace;
55
+ };
56
+
57
+ application.matrixAmmo.applyQuatToVec = (q, vec) => {
58
+ const [x, y, z] = vec;
59
+ const qx = q.x(), qy = q.y(), qz = q.z(), qw = q.w();
60
+
61
+ // Quaternion * vector * inverse(quaternion)
62
+ const ix = qw * x + qy * z - qz * y;
63
+ const iy = qw * y + qz * x - qx * z;
64
+ const iz = qw * z + qx * y - qy * x;
65
+ const iw = -qx * x - qy * y - qz * z;
66
+
67
+ return {
68
+ x: ix * qw + iw * -qx + iy * -qz - iz * -qy,
69
+ y: iy * qw + iw * -qy + iz * -qx - ix * -qz,
70
+ z: iz * qw + iw * -qz + ix * -qy - iy * -qx
71
+ };
72
+ }
73
+ // -------------------------
74
+ // This code must be on top (Physics)
75
+ application.matrixAmmo.detectCollision = function() {
76
+ this.lastRoll = '';
77
+ this.presentScore = '';
78
+ let dispatcher = this.dynamicsWorld.getDispatcher();
79
+ let numManifolds = dispatcher.getNumManifolds();
80
+ for(let i = 0;i < numManifolds;i++) {
81
+ let contactManifold = dispatcher.getManifoldByIndexInternal(i);
82
+ // let numContacts = contactManifold.getNumContacts();
83
+ if(this.ground.kB == contactManifold.getBody0().kB ||
84
+ this.ground.kB == contactManifold.getBody1().kB) {
85
+ // console.log(this.ground ,'GROUND IS IN CONTACT WHO IS BODY1 ', contactManifold.getBody1())
86
+ // CHECK ROTATION BEST WAY - VISAL PART IS NOT INTEREST NOW
87
+ if(this.ground.kB == contactManifold.getBody0().kB) {
88
+ var MY_DICE_NAME = this.getNameByBody(contactManifold.getBody1());
89
+ var testR = contactManifold.getBody1().getWorldTransform().getRotation();
90
+ }
91
+ if(this.ground.kB == contactManifold.getBody1().kB) {
92
+ var MY_DICE_NAME = this.getNameByBody(contactManifold.getBody0());
93
+ var testR = contactManifold.getBody0().getWorldTransform().getRotation();
94
+ }
95
+ var passed = false;
96
+ const face = application.matrixAmmo.detectTopFaceFromQuat(testR);
97
+ if(face) {
98
+ this.lastRoll = face.toString();
99
+ // Update score logic
100
+ dispatchEvent(new CustomEvent(`dice-${face}`, {detail: {result: `dice-${face}`, cubeId: MY_DICE_NAME}}));
101
+ }
102
+ // if(Math.abs(testR.y()) < 0.00001) {
103
+ // this.lastRoll = "3";
104
+ // this.presentScore += 4;
105
+ // passed = true;
106
+ // }
107
+ // if(Math.abs(testR.x()) < 0.00001) {
108
+ // this.lastRoll = "5";
109
+ // this.presentScore += 3;
110
+ // passed = true;
111
+ // }
112
+ // if(testR.x().toString().substring(0, 5) == testR.y().toString().substring(1, 6)) {
113
+ // this.lastRoll = "6";
114
+ // this.presentScore += 2;
115
+ // passed = true;
116
+ // }
117
+ // if(testR.x().toString().substring(0, 5) == testR.y().toString().substring(0, 5)) {
118
+ // this.lastRoll = "2";
119
+ // this.presentScore += 1;
120
+ // passed = true;
121
+ // }
122
+ // if(testR.z().toString().substring(0, 5) == testR.y().toString().substring(1, 6)) {
123
+ // this.lastRoll = "4";
124
+ // this.presentScore += 6;
125
+ // passed = true;
126
+ // }
127
+ // if(testR.z().toString().substring(0, 5) == testR.y().toString().substring(0, 5)) {
128
+ // this.lastRoll = "1";
129
+ // this.presentScore += 5;
130
+ // passed = true;
131
+ // }
132
+ // if(passed == true) dispatchEvent(new CustomEvent(`dice-${this.lastRoll}`, {
133
+ // detail: {
134
+ // result: `dice-${this.lastRoll}`,
135
+ // cubeId: MY_DICE_NAME
136
+ // }
137
+ // }))
138
+ }
139
+ }
140
+ }
141
+
142
+ addRaycastListener();
143
+ addEventListener("ray.hit.event", (e) => {
144
+ if(byId('topTitleDOM') && byId('topTitleDOM').getAttribute('data-gamestatus') != 'FREE' &&
145
+ byId('topTitleDOM').getAttribute('data-gamestatus') != 'status-select') {
146
+ console.log('no hit in middle of game ...');
147
+ return;
148
+ }
149
+
150
+ if(application.dices.STATUS == "FREE_TO_PLAY") {
151
+ console.log("hit cube status free to play prevent pick. ", e.detail.hitObject.name)
152
+ } else if(application.dices.STATUS == "SELECT_DICES_1" ||
153
+ application.dices.STATUS == "SELECT_DICES_2" ||
154
+ application.dices.STATUS == "FINISHED") {
155
+
156
+ if(Object.keys(application.dices.SAVED_DICES).length >= 5) {
157
+ console.log("PREVENTED SELECT1/2 pick.", e.detail.hitObject.name)
158
+ return;
159
+ }
160
+ console.log("hit cube status SELECT1/2 pick.", e.detail.hitObject.name)
161
+ application.dices.pickDice(e.detail.hitObject.name)
162
+ }
163
+ });
164
+
165
+ addEventListener('mousemove', (e) => {
166
+ // console.log('only on click')
167
+
168
+ })
169
+
170
+ // Sounds
171
+ application.matrixSounds.createAudio('start', 'res/audios/start.mp3', 1)
172
+ application.matrixSounds.createAudio('block', 'res/audios/block.mp3', 6)
173
+ application.matrixSounds.createAudio('dice1', 'res/audios/dice1.mp3', 6)
174
+ application.matrixSounds.createAudio('dice2', 'res/audios/dice2.mp3', 6)
175
+ application.matrixSounds.createAudio('hover', 'res/audios/toggle_002.mp3', 3)
176
+ application.matrixSounds.createAudio('roll', 'res/audios/dice-roll.mp3', 2)
177
+
178
+ addEventListener('AmmoReady', () => {
179
+
180
+ app.matrixAmmo.speedUpSimulation = 2;
181
+
182
+ downloadMeshes({
183
+ cube: "./res/meshes/jamb/dice.obj",
184
+ }, onLoadObj, {scale: [1, 1, 1], swap: [null]})
185
+
186
+ downloadMeshes({
187
+ star1: "./res/meshes/shapes/star1.obj",
188
+ }, (m) => {
189
+
190
+ let o = {
191
+ scale: 2,
192
+ position: {x: 3, y: 0, z: -10},
193
+ rotation: {x: 0, y: 0, z: 0},
194
+ rotationSpeed: {x: 10, y: 0, z: 0},
195
+ texturesPaths: ['./res/textures/default.png']
196
+ };
197
+ // application.addCube(o)
198
+
199
+ // application.addMeshObj({
200
+ // position: {x: 0, y: 6, z: -5},
201
+ // rotation: {x: 0, y: 0, z: 0},
202
+ // rotationSpeed: {x: 0, y: 0, z: 0},
203
+ // texturesPaths: ['./res/meshes/jamb/dice.png'],
204
+ // useUVShema4x2: true,
205
+ // name: 'star1',
206
+ // mesh: m.star1,
207
+ // raycast: {enabled: true, radius: 2},
208
+ // physics: {
209
+ // enabled: true,
210
+ // geometry: "Cube"
211
+ // }
212
+ // })
213
+ }, {scale: [11, 11, 11], swap: [null]})
214
+
215
+ downloadMeshes({
216
+ bg: "./res/meshes/jamb/bg.obj",
217
+ }, onLoadObjFloor, {scale: [3, 1, 3], swap: [null]})
218
+
219
+ downloadMeshes({
220
+ mainTitle: "./res/meshes/jamb/jamb-title.obj",
221
+ }, onLoadObjOther, {scale: [3, 2, 3], swap: [null]})
222
+
223
+ downloadMeshes({
224
+ cube: "./res/meshes/jamb/dice.obj",
225
+ }, onLoadObjWallCenter, {scale: [50, 10, 10], swap: [null]})
226
+
227
+ downloadMeshes({
228
+ cube: "./res/meshes/jamb/dice.obj",
229
+ }, (m) => {
230
+ for(var key in m) {
231
+ // console.log(`%c Loaded objs -> : ${key} `, LOG_MATRIX);
232
+ }
233
+ // right
234
+ application.addMeshObj({
235
+ position: {x: 25, y: 5.5, z: -25},
236
+ rotation: {x: 0, y: -22, z: 0},
237
+ scale: [25, 10, 4],
238
+ texturesPaths: ['./res/meshes/jamb/text.png'],
239
+ name: 'wallRight',
240
+ mesh: m.cube,
241
+ physics: {
242
+ mass: 0,
243
+ enabled: true,
244
+ geometry: "Cube"
245
+ }
246
+ })
247
+
248
+ application.addMeshObj({
249
+ position: {x: -25, y: 5.5, z: -25},
250
+ rotation: {x: 0, y: 22, z: 0},
251
+ scale: [25, 10, 4],
252
+ texturesPaths: ['./res/meshes/jamb/text.png'],
253
+ name: 'wallLeft',
254
+ mesh: m.cube,
255
+ physics: {
256
+ mass: 0,
257
+ enabled: true,
258
+ geometry: "Cube"
259
+ }
260
+ })
261
+ }, {scale: [25, 10, 4], swap: [null]})
262
+
263
+ })
264
+
265
+ function onLoadObjWallCenter(m) {
266
+ application.myLoadedMeshesWalls = m;
267
+ for(var key in m) {
268
+ // console.log(`%c Loaded objs -> : ${key} `, LOG_MATRIX);
269
+ }
270
+
271
+ // WALLS Center
272
+ application.addMeshObj({
273
+ position: {x: 0, y: 5, z: -45},
274
+ rotation: {x: 0, y: 0, z: 0},
275
+ scale: [50, 10, 10],
276
+ texturesPaths: ['./res/meshes/jamb/text.png'],
277
+ name: 'wallCenter',
278
+ mesh: m.cube,
279
+ physics: {
280
+ mass: 0,
281
+ enabled: true,
282
+ geometry: "Cube"
283
+ }
284
+ })
285
+ }
286
+
287
+ function onLoadObjOther(m) {
288
+ application.myLoadedMeshes = m;
289
+ // Add logo text top
290
+ application.addMeshObj({
291
+ position: {x: 0, y: 6, z: -15},
292
+ rotation: {x: 0, y: 0, z: 0},
293
+ texturesPaths: ['./res/meshes/jamb/text.png'],
294
+ name: 'mainTitle',
295
+ mesh: m.mainTitle,
296
+ physics: {
297
+ mass: 0,
298
+ enabled: true,
299
+ geometry: "Cube"
300
+ }
301
+ })
302
+ // application.cameras.WASD.pitch = 0.2
303
+ setTimeout(() => {
304
+ app.cameras.WASD.velocity[1] = 18
305
+ // BODY , x, y, z, rotX, rotY, RotZ
306
+ app.matrixAmmo.setKinematicTransform(
307
+ app.matrixAmmo.getBodyByName('mainTitle'), 0, 0, 0, 1)
308
+ app.matrixAmmo.setKinematicTransform(
309
+ app.matrixAmmo.getBodyByName('bg'), 0, -10, 0, 0, 0, 0)
310
+ // Better access getBodyByName
311
+ // console.log(' app.matrixAmmo. ', app.matrixAmmo.getBodyByName('CubePhysics1'))
312
+ }, 1200)
313
+ }
314
+
315
+ function onLoadObjFloor(m) {
316
+ application.myLoadedMeshes = m;
317
+ application.addMeshObj({
318
+ scale: [10, 0.1, 0.1],
319
+ position: {x: 0, y: 6, z: -10},
320
+ rotation: {x: 0, y: 0, z: 0},
321
+ texturesPaths: ['./res/meshes/jamb/bg.png'],
322
+ name: 'bg',
323
+ mesh: m.bg,
324
+ physics: {
325
+ collide: false,
326
+ mass: 0,
327
+ enabled: true,
328
+ geometry: "Cube"
329
+ }
330
+ })
331
+ }
332
+
333
+ function onLoadObj(m) {
334
+ application.myLoadedMeshes = m;
335
+ // Add dices
336
+ application.addMeshObj({
337
+ position: {x: 0, y: 6, z: -10},
338
+ rotation: {x: 0, y: 0, z: 0},
339
+ rotationSpeed: {x: 0, y: 0, z: 0},
340
+ texturesPaths: ['./res/meshes/jamb/dice.png'],
341
+ useUVShema4x2: true,
342
+ name: 'CubePhysics1',
343
+ mesh: m.cube,
344
+ raycast: {enabled: true, radius: 2},
345
+ physics: {
346
+ enabled: true,
347
+ geometry: "Cube"
348
+ }
349
+ })
350
+
351
+ application.addMeshObj({
352
+ position: {x: -5, y: 4, z: -14},
353
+ rotation: {x: 0, y: 0, z: 0},
354
+ rotationSpeed: {x: 0, y: 0, z: 0},
355
+ texturesPaths: ['./res/meshes/jamb/dice.png'],
356
+ useUVShema4x2: true,
357
+ name: 'CubePhysics2',
358
+ mesh: m.cube,
359
+ raycast: {enabled: true, radius: 2},
360
+ physics: {
361
+ enabled: true,
362
+ geometry: "Cube"
363
+ }
364
+ })
365
+
366
+ application.addMeshObj({
367
+ position: {x: 4, y: 8, z: -10},
368
+ rotation: {x: 0, y: 0, z: 0},
369
+ rotationSpeed: {x: 0, y: 0, z: 0},
370
+ texturesPaths: ['./res/meshes/jamb/dice.png'],
371
+ useUVShema4x2: true,
372
+ name: 'CubePhysics3',
373
+ mesh: m.cube,
374
+ raycast: {enabled: true, radius: 2},
375
+ physics: {
376
+ enabled: true,
377
+ geometry: "Cube"
378
+ }
379
+ })
380
+
381
+ application.addMeshObj({
382
+ position: {x: 3, y: 4, z: -10},
383
+ rotation: {x: 0, y: 0, z: 0},
384
+ rotationSpeed: {x: 0, y: 0, z: 0},
385
+ texturesPaths: ['./res/meshes/jamb/dice.png'],
386
+ useUVShema4x2: true,
387
+ name: 'CubePhysics4',
388
+ mesh: m.cube,
389
+ raycast: {enabled: true, radius: 2},
390
+ physics: {
391
+ enabled: true,
392
+ geometry: "Cube"
393
+ }
394
+ })
395
+
396
+ application.addMeshObj({
397
+ position: {x: -2, y: 4, z: -13},
398
+ rotation: {x: 0, y: 0, z: 0},
399
+ rotationSpeed: {x: 0, y: 0, z: 0},
400
+ texturesPaths: ['./res/meshes/jamb/dice.png'],
401
+ useUVShema4x2: true,
402
+ name: 'CubePhysics5',
403
+ mesh: m.cube,
404
+ raycast: {enabled: true, radius: 2},
405
+ physics: {
406
+ enabled: true,
407
+ geometry: "Cube"
408
+ }
409
+ })
410
+
411
+ application.addMeshObj({
412
+ position: {x: -4, y: 6, z: -9},
413
+ rotation: {x: 0, y: 0, z: 0},
414
+ rotationSpeed: {x: 0, y: 0, z: 0},
415
+ texturesPaths: ['./res/meshes/jamb/dice.png'],
416
+ useUVShema4x2: true,
417
+ name: 'CubePhysics6',
418
+ mesh: m.cube,
419
+ raycast: {enabled: true, radius: 2},
420
+ physics: {
421
+ enabled: true,
422
+ geometry: "Cube"
423
+ }
424
+ })
425
+
426
+ application.TOLERANCE = 0;
427
+ let allDiceDoneProcedure = () => {
428
+ console.log("ALL DONE", application.TOLERANCE)
429
+ application.TOLERANCE++;
430
+ if(application.TOLERANCE >= 1) {
431
+ removeEventListener('dice-1', dice1Click)
432
+ removeEventListener('dice-2', dice2Click)
433
+ removeEventListener('dice-3', dice3Click)
434
+ removeEventListener('dice-4', dice4Click)
435
+ removeEventListener('dice-5', dice5Click)
436
+ removeEventListener('dice-6', dice6Click)
437
+ console.log(`%cFINAL<preliminar> ${dices.R}`, LOG_FUNNY)
438
+ application.TOLERANCE = 0;
439
+ app.cameras.WASD.yaw = 0.01;
440
+ app.cameras.WASD.pitch = -1.26;
441
+ app.cameras.WASD.position[2] = -18;
442
+ app.cameras.WASD.position[1] = 19;
443
+ // ?? ?
444
+ if(dices.STATUS == "FREE_TO_PLAY" || dices.STATUS == "IN_PLAY") {
445
+ dices.STATUS = "SELECT_DICES_1";
446
+ console.log(`%cStatus<SELECT_DICES_1>`, LOG_FUNNY)
447
+ setTimeout(() => {
448
+ dispatchEvent(new CustomEvent('updateTitle',
449
+ {
450
+ detail: {
451
+ text: app.label.get.freetoroll,
452
+ status: 'FREE'
453
+ }
454
+ }));
455
+ }, 500);
456
+ } else if(dices.STATUS == "SELECT_DICES_1") {
457
+ dices.STATUS = "SELECT_DICES_2";
458
+ setTimeout(() => {
459
+ dispatchEvent(new CustomEvent('updateTitle',
460
+ {
461
+ detail: {
462
+ text: app.label.get.freetoroll,
463
+ status: 'FREE'
464
+ }
465
+ }));
466
+ }, 500);
467
+ console.log(`%cStatus<SELECT_DICES_2>`, LOG_FUNNY)
468
+ } else if(dices.STATUS == "SELECT_DICES_2") {
469
+ dices.STATUS = "FINISHED";
470
+ console.log(`%cStatus<FINISHED>`, LOG_FUNNY)
471
+ dispatchEvent(new CustomEvent('updateTitle',
472
+ {
473
+ detail: {
474
+ text: app.label.get.pick5,
475
+ status: 'status-select'
476
+ }
477
+ }));
478
+ }
479
+ }
480
+ };
481
+
482
+ addEventListener('all-done', allDiceDoneProcedure);
483
+
484
+ addEventListener('FREE_TO_PLAY', () => {
485
+ // Big reset
486
+ console.log(`%c<Big reset needed ...>`, LOG_FUNNY)
487
+ app.dices.SAVED_DICES = {};
488
+ app.dices.setStartUpPosition();
489
+ setTimeout(() => {
490
+ app.dices.activateAllDicesPhysics();
491
+ }, 1000);
492
+ app.cameras.WASD.yaw = 0;
493
+ app.cameras.WASD.pitch = 0;
494
+ app.cameras.WASD.position[2] = 0;
495
+ app.cameras.WASD.position[1] = 3.76;
496
+
497
+ dispatchEvent(new CustomEvent('updateTitle',
498
+ {
499
+ detail: {
500
+ text: app.label.get.hand1,
501
+ status: 'FREE'
502
+ }
503
+ }));
504
+ })
505
+
506
+ // ACTIONS
507
+ let dice1Click = (e) => {
508
+ // console.info('DICE 1 click ?????????', e.detail)
509
+ dices.R[e.detail.cubeId] = '1';
510
+ dices.checkAll()
511
+ };
512
+
513
+ let dice2Click = (e) => {
514
+ // console.info('DICE 2', e.detail)
515
+ dices.R[e.detail.cubeId] = '2';
516
+ dices.checkAll()
517
+ };
518
+
519
+ let dice3Click = (e) => {
520
+ // console.info('DICE 3', e.detail)
521
+ dices.R[e.detail.cubeId] = '3';
522
+ dices.checkAll()
523
+ };
524
+
525
+ let dice4Click = (e) => {
526
+ // console.info('DICE 4', e.detail)
527
+ dices.R[e.detail.cubeId] = '4';
528
+ dices.checkAll()
529
+ }
530
+
531
+ let dice5Click = (e) => {
532
+ // console.info('DICE 5', e.detail)
533
+ dices.R[e.detail.cubeId] = '5';
534
+ dices.checkAll()
535
+ }
536
+
537
+ let dice6Click = (e) => {
538
+ // console.info('DICE 6', e.detail)
539
+ dices.R[e.detail.cubeId] = '6';
540
+ dices.checkAll()
541
+ }
542
+
543
+ function shootDice(x) {
544
+ setTimeout(() => {
545
+ app.matrixAmmo.getBodyByName(`CubePhysics${x}`).setAngularVelocity(new Ammo.btVector3(
546
+ randomFloatFromTo(3, 12), 9, 9
547
+ ))
548
+ app.matrixAmmo.getBodyByName(`CubePhysics${x}`).setLinearVelocity(new Ammo.btVector3(
549
+ randomFloatFromTo(-5, 5), 15, -20
550
+ ))
551
+ setTimeout(() => app.matrixSounds.play('roll'), 1500)
552
+ }, 200 * x)
553
+ }
554
+
555
+ application.activateDiceClickListener = (index) => {
556
+ index = parseInt(index);
557
+ switch(index) {
558
+ case 1:
559
+ addEventListener('dice-1', dice1Click)
560
+ case 2:
561
+ addEventListener('dice-2', dice2Click)
562
+ case 3:
563
+ addEventListener('dice-3', dice3Click)
564
+ case 4:
565
+ addEventListener('dice-4', dice4Click)
566
+ case 5:
567
+ addEventListener('dice-5', dice5Click)
568
+ case 6:
569
+ addEventListener('dice-6', dice6Click)
570
+ }
571
+ };
572
+
573
+ let rollProcedure = () => {
574
+ if(topTitleDOM.getAttribute('data-gamestatus') != 'FREE') {
575
+ console.log('validation fails...');
576
+ return;
577
+ }
578
+ if(dices.STATUS == "FREE_TO_PLAY") {
579
+ app.matrixSounds.play('start')
580
+ dices.STATUS = "IN_PLAY";
581
+ dispatchEvent(new CustomEvent('updateTitle',
582
+ {
583
+ detail: {
584
+ text: app.label.get.hand1,
585
+ status: 'inplay'
586
+ }
587
+ }));
588
+ addEventListener('dice-1', dice1Click)
589
+ addEventListener('dice-2', dice2Click)
590
+ addEventListener('dice-3', dice3Click)
591
+ addEventListener('dice-4', dice4Click)
592
+ addEventListener('dice-5', dice5Click)
593
+ addEventListener('dice-6', dice6Click)
594
+
595
+ for(var x = 1;x < 7;x++) {
596
+ shootDice(x)
597
+ }
598
+ } else if(dices.STATUS == "SELECT_DICES_1" || dices.STATUS == "SELECT_DICES_2") {
599
+ // Now no selected dices still rolling
600
+ for(let i = 1;i <= 6;i++) {
601
+ const key = "CubePhysics" + i;
602
+ if(!(key in app.dices.SAVED_DICES)) {
603
+ console.log("Still in game last char is id : ", key[key.length - 1]);
604
+ application.activateDiceClickListener(parseInt(key[key.length - 1]))
605
+ shootDice(key[key.length - 1])
606
+ } else {
607
+ console.log("??????????Still in game last char is id : ", key[key.length - 1]);
608
+ application.activateDiceClickListener(parseInt(key[key.length - 1]))
609
+ }
610
+ }
611
+ // ????
612
+ // application.activateDiceClickListener(1);
613
+
614
+ dispatchEvent(new CustomEvent('updateTitle',
615
+ {
616
+ detail: {
617
+ text: dices.STATUS == "SELECT_DICES_1" ? app.label.get.hand1 : app.label.get.hand2,
618
+ status: 'inplay'
619
+ }
620
+ }));
621
+
622
+ } else if(dices.STATUS == "FINISHED") {
623
+ mb.error('No more roll...');
624
+ mb.show('Pick up 5 dices');
625
+ }
626
+ }
627
+
628
+ addEventListener('DICE.ROLL', rollProcedure)
629
+ app.ROLL = () => {
630
+ dispatchEvent(new CustomEvent('DICE.ROLL', {}))
631
+ }
632
+ }
633
+ })
634
+
635
+ window.app = application
@@ -0,0 +1,51 @@
1
+ export const cubeVertexSize = 4 * 10; // Byte size of one cube vertex.
2
+ export const cubePositionOffset = 0;
3
+ export const cubeColorOffset = 4 * 4; // Byte offset of cube vertex color attribute.
4
+ export const cubeUVOffset = 4 * 8;
5
+ export const cubeVertexCount = 36;
6
+
7
+ // prettier-ignore
8
+ export const cubeVertexArray = new Float32Array([
9
+ // float4 position, float4 color, float2 uv,
10
+ 1, -1, 1, 1, 1, 0, 1, 1, 0, 1,
11
+ -1, -1, 1, 1, 0, 0, 1, 1, 1, 1,
12
+ -1, -1, -1, 1, 0, 0, 0, 1, 1, 0,
13
+ 1, -1, -1, 1, 1, 0, 0, 1, 0, 0,
14
+ 1, -1, 1, 1, 1, 0, 1, 1, 0, 1,
15
+ -1, -1, -1, 1, 0, 0, 0, 1, 1, 0,
16
+
17
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
18
+ 1, -1, 1, 1, 1, 0, 1, 1, 1, 1,
19
+ 1, -1, -1, 1, 1, 0, 0, 1, 1, 0,
20
+ 1, 1, -1, 1, 1, 1, 0, 1, 0, 0,
21
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
22
+ 1, -1, -1, 1, 1, 0, 0, 1, 1, 0,
23
+
24
+ -1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
25
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
26
+ 1, 1, -1, 1, 1, 1, 0, 1, 1, 0,
27
+ -1, 1, -1, 1, 0, 1, 0, 1, 0, 0,
28
+ -1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
29
+ 1, 1, -1, 1, 1, 1, 0, 1, 1, 0,
30
+
31
+ -1, -1, 1, 1, 0, 0, 1, 1, 0, 1,
32
+ -1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
33
+ -1, 1, -1, 1, 0, 1, 0, 1, 1, 0,
34
+ -1, -1, -1, 1, 0, 0, 0, 1, 0, 0,
35
+ -1, -1, 1, 1, 0, 0, 1, 1, 0, 1,
36
+ -1, 1, -1, 1, 0, 1, 0, 1, 1, 0,
37
+
38
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
39
+ -1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
40
+ -1, -1, 1, 1, 0, 0, 1, 1, 1, 0,
41
+ -1, -1, 1, 1, 0, 0, 1, 1, 1, 0,
42
+ 1, -1, 1, 1, 1, 0, 1, 1, 0, 0,
43
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
44
+
45
+ 1, -1, -1, 1, 1, 0, 0, 1, 0, 1,
46
+ -1, -1, -1, 1, 0, 0, 0, 1, 1, 1,
47
+ -1, 1, -1, 1, 0, 1, 0, 1, 1, 0,
48
+ 1, 1, -1, 1, 1, 1, 0, 1, 0, 0,
49
+ 1, -1, -1, 1, 1, 0, 0, 1, 0, 1,
50
+ -1, 1, -1, 1, 0, 1, 0, 1, 1, 0,
51
+ ]);
@@ -0,0 +1,21 @@
1
+
2
+ app.matrixAmmo.rigidBodies[0].setAngularVelocity(new Ammo.btVector3(5,6,0))
3
+ app.matrixAmmo.rigidBodies[0].setLinearVelocity(new Ammo.btVector3(-0,16,1))
4
+
5
+
6
+ dice shema for now
7
+ ====================
8
+ FOR 4 gives 1
9
+ 2 6
10
+ 6 5
11
+ 1 2
12
+ 3 4
13
+ 5 3
14
+
15
+
16
+
17
+ https://phaser.discourse.group/t/disable-all-collision-impacts-matter-js/13715/2
18
+
19
+
20
+ https://stackoverflow.com/questions/17755848/is-it-possible-to-disable-x-z-rotation-in-ammo-js
21
+
Binary file