Anand Vaidya
Anand Vaidya

Reputation: 649

Display text inside 3D box using aframe /aframe-ar

I do want to display some text inside 3D box image using aframe in ar.js.

Following is the HTML code

<!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>

My main task is to project some dynamic text inside the 3D box. But for instance, I am trying to put some static text. But unable to do so. Does anybody know how can I add text inside the box?

Upvotes: 0

Views: 4198

Answers (1)

Piotr Adam Milewski
Piotr Adam Milewski

Reputation: 14655

actually Your code is working, but both the box, and text are white + the text is really small:

enter image description here


If You enlarge it a bit + make it black, it would be apparent, that it is there:

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

enter image description here

Upvotes: 3

Related Questions