import * as AFRAME from "aframe"; AFRAME.registerComponent("gps-new-entity-place", { schema: { longitude: { type: "number", default: 0, }, latitude: { type: "number", default: 0, }, }, init: function () { const camera = document.querySelector("[gps-new-camera]"); if (!camera.components["gps-new-camera"]) { console.error("gps-new-camera not initialised"); return; } this._cameraGps = camera.components["gps-new-camera"]; }, update: function () { const projCoords = this._cameraGps.threeLoc.lonLatToWorldCoords( this.data.longitude, this.data.latitude ); this.el.object3D.position.set( projCoords[0], this.el.object3D.position.y, projCoords[1] ); }, });