diff --git a/src/components/nav-mesh-helper.js b/src/components/nav-mesh-helper.js new file mode 100644 index 0000000000000000000000000000000000000000..2e0707668e1c812b30b321b2ce5852fc215fc15f --- /dev/null +++ b/src/components/nav-mesh-helper.js @@ -0,0 +1,16 @@ +AFRAME.registerComponent("nav-mesh-helper", { + schema: { + teleportControls: { type: "selectorAll", default: "[teleport-controls]" } + }, + + init: function() { + const teleportControls = this.data.teleportControls; + this.el.addEventListener("model-loaded", () => { + if (!teleportControls) return; + + for (let i = 0; i < teleportControls.length; i++) { + teleportControls[i].components["teleport-controls"].queryCollisionEntities(); + } + }); + } +}); diff --git a/src/hub.html b/src/hub.html index d8f1252d6b54ec5b54a30b5196e042cfc4961c60..0ad99accdb00fc5b88b0b94e5319e98ba9f6b68f 100644 --- a/src/hub.html +++ b/src/hub.html @@ -277,7 +277,7 @@ ></a-entity> <!-- Environment --> - <a-entity id="environment-root" position="0 0 0"></a-entity> + <a-entity id="environment-root" position="0 0 0" nav-mesh-helper></a-entity> <a-entity id="skybox" diff --git a/src/hub.js b/src/hub.js index fc843649946ff6630563dfa1c1efd78e1d2b00d1..7a5df31f5ffabd340353c2a8b6807c591bc94ccc 100644 --- a/src/hub.js +++ b/src/hub.js @@ -77,6 +77,8 @@ import "./components/super-spawner"; import "./components/super-cursor"; import "./components/event-repeater"; +import "./components/nav-mesh-helper"; + import registerNetworkSchemas from "./network-schemas"; import { inGameActions, config as inputConfig } from "./input-mappings"; import registerTelemetry from "./telemetry";