Я ищу способ разместить больше моделей 3D с дополненной реальностью и отобразить их в одной сцене. На данный момент веб-приложение может отображать больше моделей, но они будут выглядеть так, как если бы они были расположены с одинаковыми координатами (широта, долгота). Модели можно загрузить из Google Poly. Вот код:
let realAsset;
for(let i = 0; i < asset.length; i++) {
if(localStorage["asset" + i] != undefined) {
realAsset = JSON.parse(localStorage["asset" + i]);
console.log("Asset[i] = " + realAsset);
await DemoUtils.loadModel(realAsset).then(model => {
this.model = model;
this.model.children.forEach(mesh => mesh.castShadow = true);
this.model.scale.set(1, 1, 1);
});
this.camera = new THREE.PerspectiveCamera();
this.camera.matrixAutoUpdate = false;
this.reticle = new Reticle(this.session, this.camera);
this.scene.add(this.reticle);
this.frameOfRef = await this.session.requestFrameOfReference('eye-level');
this.session.requestAnimationFrame(this.onXRFrame);
const hitMatrix = new THREE.Matrix4().fromArray([1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, -1, -2, 1]);
this.model.position.setFromMatrixPosition(hitMatrix);
DemoUtils.lookAtOnY(this.model, this.camera);
const shadowMesh = this.scene.children.find(c => c.name === 'shadowMesh');
shadowMesh.position.y = this.model.position.y;
this.scene.add(this.model);
}
Интересно, есть ли в API какой-либо метод, позволяющий мне размещать модели с использованием координат.