Skip to content

Commit

Permalink
don't hit invisible geometry (google#3599)
Browse files Browse the repository at this point in the history
  • Loading branch information
elalish authored Jul 22, 2022
1 parent c5e3bb2 commit f347c4b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/model-viewer/src/three-components/ModelScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,8 @@ export class ModelScene extends Scene {
this.raycaster.setFromCamera(ndcPosition, this.getCamera());
const hits = this.raycaster.intersectObject(object, true);

const hit = hits.find((hit) => !hit.object.userData.shadow);
const hit =
hits.find((hit) => hit.object.visible && !hit.object.userData.shadow);
if (hit == null || hit.face == null) {
return null;
}
Expand Down

0 comments on commit f347c4b

Please sign in to comment.