如何仅在特定实体上触发游标融合
How to trigger cursor fuse on specific entities only
我的相机和光标是这样设置的:
<a-camera>
<a-cursor
fuse="true"
animation__fusing="property: scale; startEvents: fusing; easing: easeInCubic; dur: 1500; from: 1 1 1; to: 0.1 0.1 0.1"
animation__mouseleave="property: scale; startEvents: mouseleave; easing: easeInCubic; dur: 500; to: 1 1 1">
</a-cursor>
</a-camera>
场景如下:
<a-entity id="scene1">
<a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9" onclick="changeLevel('scene1', 'scene2')"></a-box>
<a-sky src="background1.png"></a-sky>
</a-entity>
现在光标总是在融合,甚至在看天空盒时也是如此。是否可以仅在查看可点击实体时启动融合动画?
谢谢
您可以通过raycaster component配置光标。在你的情况下:
<a-cursor fuse="true" raycaster="objects: a-box" ....
您可以为您的交互对象设置一个class,以明确:
<a-box class="clickable"></a-box>
...
<a-cursor raycaster="objects: .clickable" ...
看看here。
我的相机和光标是这样设置的:
<a-camera>
<a-cursor
fuse="true"
animation__fusing="property: scale; startEvents: fusing; easing: easeInCubic; dur: 1500; from: 1 1 1; to: 0.1 0.1 0.1"
animation__mouseleave="property: scale; startEvents: mouseleave; easing: easeInCubic; dur: 500; to: 1 1 1">
</a-cursor>
</a-camera>
场景如下:
<a-entity id="scene1">
<a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9" onclick="changeLevel('scene1', 'scene2')"></a-box>
<a-sky src="background1.png"></a-sky>
</a-entity>
现在光标总是在融合,甚至在看天空盒时也是如此。是否可以仅在查看可点击实体时启动融合动画? 谢谢
您可以通过raycaster component配置光标。在你的情况下:
<a-cursor fuse="true" raycaster="objects: a-box" ....
您可以为您的交互对象设置一个class,以明确:
<a-box class="clickable"></a-box>
...
<a-cursor raycaster="objects: .clickable" ...
看看here。