diff --git a/src/components/super-spawner.js b/src/components/super-spawner.js index 41e2d7aeabbe77f2dc0ba9b3821170fab9724db5..1f5368cfbd7e6518c26fc212b13a8a034406d831 100644 --- a/src/components/super-spawner.js +++ b/src/components/super-spawner.js @@ -3,6 +3,8 @@ AFRAME.registerComponent("super-spawner", { template: { default: "" }, useCustomSpawnPosition: { default: false }, spawnPosition: { type: "vec3" }, + useCustomSpawnRotation: { default: false }, + spawnRotation: { type: "vec4" }, events: { default: ["cursor-grab", "action_grab"] }, spawnCooldown: { default: 1 } }, @@ -10,7 +12,6 @@ AFRAME.registerComponent("super-spawner", { init: function() { this.entities = new Map(); this.timeout = null; - this.defaultScale = this.el.getAttribute("scale").clone(); }, play: function() { @@ -24,7 +25,7 @@ AFRAME.registerComponent("super-spawner", { clearTimeout(this.timeout); this.timeout = null; this.el.setAttribute("visible", true); - this.el.setAttribute("scale", this.defaultScale); + this.el.classList.add("interactable"); }, remove: function() { @@ -61,14 +62,16 @@ AFRAME.registerComponent("super-spawner", { const pos = this.data.useCustomSpawnPosition ? this.data.spawnPosition : this.el.getAttribute("position"); entity.setAttribute("position", pos); + const rot = this.data.useCustomSpawnRotation ? this.data.spawnRotation : this.el.getAttribute("rotation"); + entity.setAttribute("rotation", rot); this.el.sceneEl.appendChild(entity); if (this.data.spawnCooldown > 0) { this.el.setAttribute("visible", false); - this.el.setAttribute("scale", { x: 0.0001, y: 0.0001, z: 0.0001 }); + this.el.classList.remove("interactable"); this.timeout = setTimeout(() => { this.el.setAttribute("visible", true); - this.el.setAttribute("scale", this.defaultScale); + this.el.classList.add("interactable"); this.timeout = null; }, this.data.spawnCooldown * 1000); } diff --git a/src/hub.html b/src/hub.html index af1bb3ef2bf5ff1ccd6839793ac70b7395af89f0..34f642b64adec241532b4ef9ea9964d809675a8b 100644 --- a/src/hub.html +++ b/src/hub.html @@ -63,7 +63,7 @@ <a-asset-item id="botwoody" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/bots/BotWoody_Avatar-0140485a23.gltf"></a-asset-item> <a-asset-item id="watch-model" response-type="arraybuffer" src="./assets/hud/watch.glb"></a-asset-item> - <a-asset-item id="interactable-duck" response-type="arraybuffer" src="./assets/interactables/duck/DuckyMesh.glb"></a-asset-item> + <a-asset-item id="interactable-duck" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/interactables/Ducky/DuckyMesh-438ff8e022.gltf"></a-asset-item> <a-asset-item id="quack" src="./assets/sfx/quack.mp3" response-type="arraybuffer" preload="auto"></a-asset-item> <a-asset-item id="specialquack" src="./assets/sfx/specialquack.mp3" response-type="arraybuffer" preload="auto"></a-asset-item> @@ -165,7 +165,6 @@ <template id="interactable-template"> <a-entity gltf-model-plus="src: #interactable-duck; inflate: true;" - scale="2 2 2" class="interactable" super-networked-interactable="counter: #counter; mass: 1;" body="type: dynamic; shape: none; mass: 1;"