Skip to content

Commit

Permalink
Fix intersectObject with .json objects [refs #16]
Browse files Browse the repository at this point in the history
  • Loading branch information
KiWiGiW committed Dec 22, 2020
1 parent e009a81 commit b55f3a0
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/threedigitaltwin.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ export default class ThreeDigitalTwin {
return mesh;
}


async createModelGLTF(feature) {
var coordX;
var coordY;
Expand Down Expand Up @@ -1320,11 +1320,18 @@ export default class ThreeDigitalTwin {
var params = { Mesh: {}, Line: { threshold: 50 }, LOD: {}, Points: { threshold: 5 }, Sprite: {} };
this.raycaster.params = params;
this.raycaster.setFromCamera(this.mouse, this.camera);
var intersects = this.raycaster.intersectObjects(this.scene.children);

if (intersects.length > 0) {
this.dispatch('intersectObject', intersects[0].object);

try {
var intersects = this.raycaster.intersectObjects(this.scene.children);
console.log("Passou", intersects);
if (intersects.length > 0) {
this.dispatch('intersectObject', intersects[0].object);
}
}
catch (err) {
if (!(err instanceof TypeError)) {
console.log("err", err);
}
}
}

Expand Down

0 comments on commit b55f3a0

Please sign in to comment.