diff --git a/package.json b/package.json index c2edbf212da7e9a6652e2ffc943b3024c1f2ef28..3d2d728ad27b8c678c37b592761a82a063b7155b 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "aframe-extras": "^4.0.0", "aframe-input-mapping-component": "https://github.com/johnshaughnessy/aframe-input-mapping-component#feature/map-to-array", "aframe-physics-extras": "https://github.com/infinitelee/aframe-physics-extras#fix/physics-collider-crash", - "aframe-physics-system": "https://github.com/donmccurdy/aframe-physics-system", + "aframe-physics-system": "https://github.com/infinitelee/aframe-physics-system#feature/shape-component", "aframe-teleport-controls": "^0.3.1", "aframe-rounded": "^1.0.3", "aframe-xr": "github:brianpeiris/aframe-xr#3162aed", @@ -36,7 +36,7 @@ "mobile-detect": "^1.4.1", "moving-average": "^1.0.0", "naf-janus-adapter": "https://github.com/mozilla/naf-janus-adapter#feature/disconnect", - "networked-aframe": "github:mozillareality/networked-aframe#feature/sound-source-set", + "networked-aframe": "github:mozillareality/networked-aframe#mr-social-client/master", "nipplejs": "^0.6.7", "query-string": "^5.0.1", "raven-js": "^3.20.1", diff --git a/src/assets/interactables/duck/DuckyMesh.glb b/src/assets/interactables/duck/DuckyMesh.glb index 5bb10e0cd79c623f72f87d438f6eddbe1d0dc250..f50dc37942d519c36e16a5e41bb8a44a18c4c7f1 100644 Binary files a/src/assets/interactables/duck/DuckyMesh.glb and b/src/assets/interactables/duck/DuckyMesh.glb differ diff --git a/src/assets/interactables/duck/gltf/DuckyMesh.fbm/Ducky.jpg b/src/assets/interactables/duck/gltf/DuckyMesh.fbm/Ducky.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6c27845f40d1e4b91ddb5534c413f408580ed51e Binary files /dev/null and b/src/assets/interactables/duck/gltf/DuckyMesh.fbm/Ducky.jpg differ diff --git a/src/assets/interactables/duck/gltf/DuckyMesh.gltf b/src/assets/interactables/duck/gltf/DuckyMesh.gltf new file mode 100644 index 0000000000000000000000000000000000000000..83cc03646480c7cec3849fda0a8fd3580cec3abc --- /dev/null +++ b/src/assets/interactables/duck/gltf/DuckyMesh.gltf @@ -0,0 +1,248 @@ +{ + "asset": { + "generator": "FBX2glTF", + "version": "2.0" + }, + "scene": 0, + "buffers": [ + { + "byteLength": 18600, + "uri": "buffer.bin" + } + ], + "bufferViews": [ + { + "buffer": 0, + "byteLength": 3336, + "byteOffset": 0, + "target": 34963 + }, + { + "buffer": 0, + "byteLength": 5724, + "byteOffset": 3336, + "target": 34962 + }, + { + "buffer": 0, + "byteLength": 5724, + "byteOffset": 9060, + "target": 34962 + }, + { + "buffer": 0, + "byteLength": 3816, + "byteOffset": 14784, + "target": 34962 + } + ], + "scenes": [ + { + "name": "Root Scene", + "nodes": [ + 0 + ], + "extras": { + "components": { + "shape": [ + { + "shape": "box", + "halfExtents": { + "x": 0.06, + "y": 0.04, + "z": 0.08 + }, + "offset": { + "x": 0, + "y": 0.052671334114334445, + "z": 0.01001389278835843 + }, + "orientation": { + "x": 0, + "y": 0, + "z": 0, + "w": 1 + } + }, + { + "shape": "sphere", + "radius": 0.05, + "offset": { + "x": 0, + "y": 0.1287570519589527, + "z": 0.033095376412929145 + }, + "orientation": { + "x": 0, + "y": 0, + "z": 0, + "w": 1 + } + }, + { + "shape": "cylinder", + "radiusTop": 0.02, + "radiusBottom": 0.02, + "height": 0.030000000000000013, + "numSegments": 8, + "offset": { + "x": 0, + "y": 0.12657048237702667, + "z": 0.09010837508332667 + }, + "orientation": { + "x": 0.7071067811865476, + "y": 0, + "z": 0, + "w": 0.7071067811865475 + } + } + ] + } + } + } + ], + "accessors": [ + { + "componentType": 5123, + "type": "SCALAR", + "count": 1668, + "bufferView": 0, + "byteOffset": 0 + }, + { + "componentType": 5126, + "type": "VEC3", + "count": 477, + "bufferView": 1, + "byteOffset": 0, + "min": [ + -0.0587991699576378, + 0.0129461474716663, + -0.0740185976028442 + ], + "max": [ + 0.0618169121444225, + 0.173104390501976, + 0.104356855154037 + ] + }, + { + "componentType": 5126, + "type": "VEC3", + "count": 477, + "bufferView": 2, + "byteOffset": 0 + }, + { + "componentType": 5126, + "type": "VEC2", + "count": 477, + "bufferView": 3, + "byteOffset": 0 + } + ], + "images": [ + { + "name": "DuckyMesh.fbm/Ducky.jpg", + "uri": "DuckyMesh.fbm/Ducky.jpg" + } + ], + "samplers": [ + {} + ], + "textures": [ + { + "name": "file4", + "sampler": 0, + "source": 0 + } + ], + "materials": [ + { + "name": "lambert2", + "alphaMode": "OPAQUE", + "extras": { + "fromFBX": { + "shadingModel": "Lambert", + "isTruePBR": false + } + }, + "pbrMetallicRoughness": { + "baseColorTexture": { + "index": 0, + "texCoord": 0 + }, + "baseColorFactor": [ + 0.800000011920929, + 0.800000011920929, + 0.800000011920929, + 1 + ], + "metallicFactor": 0.200000002980232, + "roughnessFactor": 0.800000011920929 + } + } + ], + "meshes": [ + { + "name": "Ducky", + "primitives": [ + { + "material": 0, + "mode": 4, + "attributes": { + "NORMAL": 2, + "POSITION": 1, + "TEXCOORD_0": 3 + }, + "indices": 0 + } + ] + } + ], + "nodes": [ + { + "name": "RootNode", + "translation": [ + 0, + 0, + 0 + ], + "rotation": [ + 0, + 0, + 0, + 1 + ], + "scale": [ + 1, + 1, + 1 + ], + "children": [ + 1 + ] + }, + { + "name": "Ducky", + "translation": [ + 0, + 0, + 0 + ], + "rotation": [ + 0, + 0, + 0, + 1 + ], + "scale": [ + 1, + 1, + 1 + ], + "mesh": 0 + } + ] +} \ No newline at end of file diff --git a/src/assets/interactables/duck/gltf/DuckyMesh.json b/src/assets/interactables/duck/gltf/DuckyMesh.json new file mode 100644 index 0000000000000000000000000000000000000000..97b41944a2ca7e12e5e12cf4892d2534ef73e5b4 --- /dev/null +++ b/src/assets/interactables/duck/gltf/DuckyMesh.json @@ -0,0 +1,60 @@ +{ + "scenes": { + "Root Scene": { + "shape": [ + { + "shape": "box", + "halfExtents": { + "x": 0.06, + "y": 0.04, + "z": 0.08 + }, + "offset": { + "x": 0, + "y": 0.052671334114334445, + "z": 0.01001389278835843 + }, + "orientation": { + "x": 0, + "y": 0, + "z": 0, + "w": 1 + } + }, + { + "shape": "sphere", + "radius": 0.05, + "offset": { + "x": 0, + "y": 0.1287570519589527, + "z": 0.033095376412929145 + }, + "orientation": { + "x": 0, + "y": 0, + "z": 0, + "w": 1 + } + }, + { + "shape": "cylinder", + "radiusTop": 0.02, + "radiusBottom": 0.02, + "height": 0.030000000000000013, + "numSegments": 8, + "offset": { + "x": 0, + "y": 0.12657048237702667, + "z": 0.09010837508332667 + }, + "orientation": { + "x": 0.7071067811865476, + "y": 0, + "z": 0, + "w": 0.7071067811865475 + } + } + ] + } + } +} diff --git a/src/assets/interactables/duck/gltf/buffer.bin b/src/assets/interactables/duck/gltf/buffer.bin new file mode 100644 index 0000000000000000000000000000000000000000..d7ed323e11aef0c4b2045dd8f2ddd34154244b84 Binary files /dev/null and b/src/assets/interactables/duck/gltf/buffer.bin differ diff --git a/src/components/super-cursor.js b/src/components/super-cursor.js index b8daee493abcbfb543db553538c5b968748da381..ee70e960663144709f17108d70a2378a6bc9f935 100644 --- a/src/components/super-cursor.js +++ b/src/components/super-cursor.js @@ -92,7 +92,7 @@ AFRAME.registerComponent("super-cursor", { this.data.cursor.object3D.position.copy(this.point); } - this.isInteractable = intersection && intersection.object.el.className === "interactable"; + this.isInteractable = intersection && this._isInteractable(intersection.object.el); if ((this.isGrabbing || this.isInteractable) && !this.wasIntersecting) { this.wasIntersecting = true; @@ -103,6 +103,13 @@ AFRAME.registerComponent("super-cursor", { } }, + _isInteractable: function(el) { + return ( + el.className === "interactable" || + (el.parentNode && el.parentNode != el.sceneEl && this._isInteractable(el.parentNode)) + ); + }, + _handleMouseDown: function() { if (this.isInteractable) { const lookControls = this.data.camera.components["look-controls"]; @@ -122,7 +129,19 @@ AFRAME.registerComponent("super-cursor", { }, _handleWheel: function(e) { - if (this.isGrabbing) this.currentDistanceMod += e.deltaY / 10; + if (this.isGrabbing) { + switch (e.deltaMode) { + case e.DOM_DELTA_PIXEL: + this.currentDistanceMod += e.deltaY / 500; + break; + case e.DOM_DELTA_LINE: + this.currentDistanceMod += e.deltaY / 10; + break; + case e.DOM_DELTA_PAGE: + this.currentDistanceMod += e.deltaY / 2; + break; + } + } }, _handleEnterVR: function() { diff --git a/src/gltf-component-mappings.js b/src/gltf-component-mappings.js index 06e81969a0f72d0d3a90ae7b247f28bf68fa2aaa..2166e7a62a186c9caa1ce3da8f39b5cafa4fff31 100644 --- a/src/gltf-component-mappings.js +++ b/src/gltf-component-mappings.js @@ -2,5 +2,6 @@ import "./components/gltf-model-plus"; AFRAME.GLTFModelPlus.registerComponent("scale-audio-feedback", "scale-audio-feedback"); AFRAME.GLTFModelPlus.registerComponent("loop-animation", "loop-animation"); +AFRAME.GLTFModelPlus.registerComponent("shape", "shape"); AFRAME.GLTFModelPlus.registerComponent("visible", "visible"); AFRAME.GLTFModelPlus.registerComponent("nav-mesh", "nav-mesh"); diff --git a/src/hub.html b/src/hub.html index 6abf08249b44d46aafdcfc01efad8238922ba7ef..2533a8931d2d6662bc82b66a9f2e9f6493b05bff 100644 --- a/src/hub.html +++ b/src/hub.html @@ -105,11 +105,11 @@ <template id="interactable-template"> <a-entity - gltf-model-plus="src: #interactable-duck" + gltf-model-plus="src: #interactable-duck; inflate: true;" scale="2 2 2" class="interactable" super-networked-interactable="counter: #counter; mass: 5;" - body="type: dynamic; mass: 5; shape: box;" + body="type: dynamic; shape: none; mass: 5;" grabbable stretchable="useWorldPosition: true;" ></a-entity> @@ -203,8 +203,6 @@ haptic-feedback ></a-entity> - - <a-entity id="player-right-controller" class="right-controller" diff --git a/yarn.lock b/yarn.lock index b0fbb73148bf34e77abcb5b506c138df09e85a66..142ae2918c72b4edca9b86ba7f12a434eb585a51 100644 --- a/yarn.lock +++ b/yarn.lock @@ -180,9 +180,9 @@ aframe-lerp-component@^1.1.0: version "0.1.2" resolved "https://github.com/infinitelee/aframe-physics-extras#49b2d5d3c0caac905783aee51d9e89dbdf7199b8" -"aframe-physics-system@https://github.com/donmccurdy/aframe-physics-system": - version "3.0.1" - resolved "https://github.com/donmccurdy/aframe-physics-system#08a98a4c3d77c4c38a1fa27067aa0d894447902e" +"aframe-physics-system@https://github.com/infinitelee/aframe-physics-system#feature/shape-component": + version "3.0.2" + resolved "https://github.com/infinitelee/aframe-physics-system#be3e43f1af5b995952e1b3d27dce216ab2e79f05" dependencies: browserify "^14.3.0" budo "^10.0.3" @@ -5355,11 +5355,10 @@ neo-async@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.0.tgz#76b1c823130cca26acfbaccc8fbaf0a2fa33b18f" -"networked-aframe@github:mozillareality/networked-aframe#feature/sound-source-set": - version "0.6.0" - resolved "https://codeload.github.com/mozillareality/networked-aframe/tar.gz/978b7c25aff26a0c1db47beb35d8a6556f717d36" +"networked-aframe@github:mozillareality/networked-aframe#mr-social-client/master": + version "0.6.1" + resolved "https://codeload.github.com/mozillareality/networked-aframe/tar.gz/69be0e7e5f66070526c8240cb795b9e88da971a9" dependencies: - aframe-lerp-component "^1.1.0" easyrtc "1.1.0" express "^4.10.7" serve-static "^1.8.0"