diff --git a/src/components/nav-mesh-helper.js b/src/components/nav-mesh-helper.js new file mode 100644 index 0000000000000000000000000000000000000000..5c1be4ce96946dddb6ba98590dc7da27d403ab10 --- /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("bundleloaded", () => { + 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 2533a8931d2d6662bc82b66a9f2e9f6493b05bff..0575e5b0156ddeac6b68a603c6fe53690c56c38f 100644 --- a/src/hub.html +++ b/src/hub.html @@ -275,7 +275,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 f1180e158dddb8c98e851e7f4421378a49395392..6d9caeb079d056ec3716b2d76dbde95fa4bb7be6 100644 --- a/src/hub.js +++ b/src/hub.js @@ -79,6 +79,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";