好吧,我想找到射线的交点的坐标
带有天空的脚轮,但问题是a)尽管添加了showline:true,但我看不到射线脚轮
b)从不访问交叉路口监听器(从不交叉路口
触发)
<html>
<head>
<script src="https://aframe.io/releases/0.8.0/aframe.min.js"> </script>
<script src="https://npmcdn.com/[email protected]"></script>
<script src="https://npmcdn.com/[email protected]"></script>
<script src="https://npmcdn.com/[email protected]"></script>
<script src="https://npmcdn.com/[email protected]"></script>
<script type="text/javascript">
AFRAME.registerComponent('collider-check', {
dependencies: ['raycaster'],
init: function () {
this.el.addEventListener('raycaster-intersected',
function (evt) {
alert(evt.detail.intersection.point);
console.log('Player hit something!');
});
}
});
</script>
</head>
<body>
<a-scene>
<a-sky class="collidable" src="{{asset('img/3_Entree_2.jpg')}}"> </a-sky>
<a-camera look-control collider-check>
<a-entity raycaster="objects: .collidable" position="0-0.9 0"
rotation="90 0 0" showLine= "true"></a-entity>
</a-camera>
</a-scene>
</body>
<html>
最佳答案
尝试进行调整,使光线投射器可以到达天空。raycaster="far: 10000"
或<a-sky radius="100">