diff --git a/package.json b/package.json index a86b58dbedf0f72813f92978b5120294ea8d4c40..59a07b02125460a7d633eea19266d236784e16fb 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "aframe-extras": "^3.12.4", "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": "https://github.com/netpro2k/aframe-teleport-controls#feature/pauseable", "aframe-xr": "github:brianpeiris/aframe-xr#3162aed", "babel-plugin-react-intl": "^2.4.0", diff --git a/src/assets/interactables/duck/DuckyMesh.glb b/src/assets/interactables/duck/DuckyMesh.glb index 5bb10e0cd79c623f72f87d438f6eddbe1d0dc250..692c430abda9cab20b506de50808d89bbf7b5b0b 100644 Binary files a/src/assets/interactables/duck/DuckyMesh.glb and b/src/assets/interactables/duck/DuckyMesh.glb differ diff --git a/src/components/super-cursor.js b/src/components/super-cursor.js index e498a1acc2ad9b99c9131134bd17560bee1af531..08079dedbdf4199fad6dff414037e5bd4645e592 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,18 @@ AFRAME.registerComponent("super-cursor", { } }, + _isInteractable: function(el) { + if (el.className === "interactable") { + return true; + } + + if(el.parentNode && el.parentNode != el.sceneEl) { + return this._isInteractable(el.parentNode); + } + + return false; + }, + _handleMouseDown: function(e) { if (this.isInteractable) { const lookControls = this.data.camera.components["look-controls"]; diff --git a/src/gltf-component-mappings.js b/src/gltf-component-mappings.js index 7c6b6a8d8774eeeda0de6f0fb074848a5e78be51..d1f9d87b0adc70e470af1ce3218008b4929a53a9 100644 --- a/src/gltf-component-mappings.js +++ b/src/gltf-component-mappings.js @@ -2,3 +2,7 @@ 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("box-shape", "box-shape"); +AFRAME.GLTFModelPlus.registerComponent("sphere-shape", "sphere-shape"); +AFRAME.GLTFModelPlus.registerComponent("cylinder-shape", "cylinder-shape"); diff --git a/src/room.html b/src/room.html index 2f252c28ef8ebb8e67bdbab6f252d28947dc61e5..6c3b371d2149fb64a654bf226408aafaeb471a0a 100644 --- a/src/room.html +++ b/src/room.html @@ -99,11 +99,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> @@ -194,8 +194,6 @@ haptic-feedback ></a-entity> - - <a-entity id="player-right-controller" class="right-controller" diff --git a/yarn.lock b/yarn.lock index b2fc3a25d7605205ddad6244206d2076f41149ac..bb5148c6e95b62c031bfd350c0b0464ff3ae9a86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -159,9 +159,9 @@ aframe-physics-system@^1.4.3: cannon "github:donmccurdy/cannon.js#v0.6.2-dev1" three-to-cannon "^1.1.1" -"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#c8add507adcb6d67ecb7613924662e413a811454" dependencies: browserify "^14.3.0" budo "^10.0.3"