I'm trying to add a click handler to a 3d model in aframe. Only a few small regions in the model trigger the click event. Can someone help me figure out why the raycaster is not hitting the object most of the time? I've added a snippet of my Angular2 template with the aframe scene. I'm using Aframe version 0.8.2.
<div
#sceneContainer
id="sceneContainer"
oncontextmenu="return false;"
(mousedown)="onMouseDown($event)"
(touchstart)="onTouchStart($event)"
(mousemove)="onMouseMove($event)"
(touchmove)="onTouchMove($event)"
[ngClass]="{invisible: !config['model']}"
style="width: 100%; height:100%; cursor:pointer;">
<a-scene id="scene" embedded vr-mode-ui="enabled: false" cursor="rayOrigin: mouse">
<a-entity id="camera" camera></a-entity>
<a-sky src="assets/sky.jpg" rotation="-20 0 0"></a-sky>
<a-plane color="#CCC" height="2" width="2" position="0 -0.5 0" rotation="-90 0 0"></a-plane>
<a-entity id="model" position="0 0 -1" (click)="modelClicked.emit($event)">
<a-entity gltf-model="https://s3.us-east-1.amazonaws.com/me.seek-ar.media.staging/53a6ebba-995d-4a75-b017-c75986807beb/a7cdb785-fcc3-41c9-9c6a-0c21ebcb0e27.glb"></a-entity>
</a-entity>
</a-scene>
</div>
Any help would be appreciated!
UPDATE:
I've found the cause of the issue. See aframe embeded scene with cursor mouse ray-origin
Scrolling or moving the scene container does not seem to update the raycaster. Does anybody have a workaround for this?