使用aframe / aframe-ar在3D框内显示文本

时间:2018-05-14 05:31:06

标签: augmented-reality aframe ar.js

我想在ar.js中使用aframe在3D框图像中显示一些文字。

以下是HTML代码

<!DOCTYPE html>
<html>
    <head>
        <script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.5.0/aframe/examples/vendor/aframe/build/aframe.min.js"></script>
        <script src="https://cdn.rawgit.com/jeromeetienne/AR.js/1.5.0/aframe/build/aframe-ar.js"></script>
        <!-- <script>THREEx.ArToolkitContext.baseURL = 'https://rawgit.com/jeromeetienne/ar.js/master/three.js/'</script> -->
    </head>
    <body style='margin : 0px; overflow: hidden;'>
        <a-scene embedded arjs='trackingMethod: best;'>
            <a-anchor hit-testing-enabled='true'>
                <a-box position='0 0.5 0' material='opacity: 0.5;'>
                <a-entity text="value: HELLO"></a-entity>
            </a-box>
        </a-anchor>
        <a-camera-static/>
        </a-scene>

    </body>
</html>

我的主要任务是在3D框中投射一些动态文本。但是,例如,我试图放一些静态文本。但无法这样做。有谁知道如何在盒子里面添加文字?

1 个答案:

答案 0 :(得分:2)

实际上你的代码正在运行,但是框和文本都是白色+文本非常小:

enter image description here

<小时/> 如果你将它放大一点+使其变黑,很明显,它就在那里:

<a-entity position="1 0 0" scale="3 3 3" text="value: HELLO;color:black"></a-entity>

enter image description here