Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Aframe 使用事件集组件和模板-组件时不显示文本_Aframe_Webvr - Fatal编程技术网

Aframe 使用事件集组件和模板-组件时不显示文本

Aframe 使用事件集组件和模板-组件时不显示文本,aframe,webvr,Aframe,Webvr,我正在使用组件制作具有多个场景的webvr,并监听鼠标键/点击,以便更改我的src glitch和下面的完整示例代码是index.html <!DOCTYPE html> <html> <head> <title>Kingdom Animalia</title> <meta name="description" content="Belajar asyik dengan WebVR"></meta&

我正在使用组件制作具有多个场景的webvr,并监听鼠标键/点击,以便更改我的src

glitch和下面的完整示例代码是index.html

<!DOCTYPE html>
<html>
  <head>
    <title>Kingdom Animalia</title>
    <meta name="description" content="Belajar asyik dengan WebVR"></meta>
    <script src="https://cdn.glitch.com/a40a8a20-2b6c-4579-a653-7b641753965e%2Fbuild.js?1531824946222"></script>
    <script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
    <script src="aframe-event-set-component.js"></script>

  </head>

  <body>
    <a-scene>

     <a-assets>
        <img id="cnidaria" src="https://cdn.glitch.com/1f690faa-4dea-4828-a14a-c8fc529e9e2d%2F492542401-56a5f70d5f9b58b7d0df4ff5.jpg?1531237316164">
        <img id="porifera" src="https://cdn.glitch.com/1f690faa-4dea-4828-a14a-c8fc529e9e2d%2FPHYLUM%20PORIFERA%20_thumb%5B6%5D.jpg?1531237318597">
        <img id="annelida" src="https://cdn.glitch.com/1f690faa-4dea-4828-a14a-c8fc529e9e2d%2Fearthworm.jpg?1531237319615">
        <img id="planaria" src="https://cdn.glitch.com/1f690faa-4dea-4828-a14a-c8fc529e9e2d%2Fmaxresdefault.jpg?1531237360227">
        <img id="mollusca" src="https://cdn.glitch.com/1f690faa-4dea-4828-a14a-c8fc529e9e2d%2F802806388.jpg?1531237319128">
        <img id="ctenophora" src="https://cdn.glitch.com/1f690faa-4dea-4828-a14a-c8fc529e9e2d%2FRedLine1.jpg?1531237316608">
      </a-assets>

      <a-entity id="ganti" template="src: main.html"
                position="0 0 0">
      </a-entity>


      <a-sky id="mask" color="#111" opacity="0" radius="2">
        <a-animation attribute="material.opacity" begin="fade" from="0" to="1" dur="200"
                     direction="alternate" repeat="1"></a-animation>
      </a-sky>
    </a-scene>


  </body>
</html>

动物王国
在main.html下面

 <a-entity
        position="-1 3 -3"
        geometry="primitive: plane; width: 8; height: auto"
        material="color: #0000FF"
        text="color: white; align: center; font: https://cdn.aframe.io/fonts/DejaVu-sdf.fnt;
              value: a-plane align:center (anchor:align) DejaVu width 8 1234567890123456789012345678901234567890">
      </a-entity>

      <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9" shadow></a-box>
      <a-sphere 
      event-set__click="_target: #ganti; template: src: boxes.html" 
      position="0 1.25 -5" radius="1.25" color="#000000" shadow></a-sphere>
      <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D" shadow></a-cylinder>
      <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4" shadow></a-plane>
      <a-sky color="#c69b9b"></a-sky>


    <a-camera>
        <a-cursor id="cursor" position="0 0 0" color= "#efdf02"></a-cursor>
      </a-camera>


到目前为止,我可以在场景中显示img、长方体、球体等,但它根本不显示任何文本。我试过很多不同的文本。文本仍然显示在其他代码中,这些代码没有使用模板和事件集组件,但在我的示例中它不会显示。如何修复此问题?

您的包含错误,首先包括
模板
组件,然后是
核心
,然后是
事件
组件

如果先加载核心,则文本将显示在
a平面上


签出它

请编辑您的问题以包含您的代码。不要发布代码链接。@TheWhiteWolf我已经编辑了这个问题,它确实有效,谢谢!但是事件集不再工作了?现在检查一下,宽度为2的“掩码”截获了点击事件,非常感谢!!它确实有用!我不知道面具出了问题!