aframe vive controller Uncaught TypeError: hand.getAttribute is not a function












0















I was trying to get and update the position of vive controller in aframe for a project.



i've tried it using d3.js



var hand = d3.select('.con_left');
var pos = hand.getAttribute('position');
console.log(pos);


but it shows the error



Uncaught TypeError: hand.getAttribute is not a function









share|improve this question



























    0















    I was trying to get and update the position of vive controller in aframe for a project.



    i've tried it using d3.js



    var hand = d3.select('.con_left');
    var pos = hand.getAttribute('position');
    console.log(pos);


    but it shows the error



    Uncaught TypeError: hand.getAttribute is not a function









    share|improve this question

























      0












      0








      0


      1






      I was trying to get and update the position of vive controller in aframe for a project.



      i've tried it using d3.js



      var hand = d3.select('.con_left');
      var pos = hand.getAttribute('position');
      console.log(pos);


      but it shows the error



      Uncaught TypeError: hand.getAttribute is not a function









      share|improve this question














      I was trying to get and update the position of vive controller in aframe for a project.



      i've tried it using d3.js



      var hand = d3.select('.con_left');
      var pos = hand.getAttribute('position');
      console.log(pos);


      but it shows the error



      Uncaught TypeError: hand.getAttribute is not a function






      d3.js aframe htc-vive






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 20 at 7:09









      PreetamHeraldPreetamHerald

      53




      53
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Newest version of d3-selection attribute method is just attr



          var hand = d3.select('.con_left');
          var pos = hand.attr('position');


          Here is an example:






          setInterval(() => {
          const box = d3.select('a-box')
          const sphere = d3.select('a-sphere')
          box.attr('position', `${-Math.random()/5} ${Math.random()/5} -3`)
          sphere.attr('position', `${Math.random()} ${1+Math.random()/5} -5`)
          }, 50);

          <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
          <script src="https://d3js.org/d3.v5.min.js"></script>
          <a-scene>
          <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
          <a-box position="-1 0.5 -3" rotation="0 45 0" width="1" height="1" depth="1" color="#4CC3D9"></a-box>
          <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
          <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
          <a-sky color="#ECECEC"></a-sky>
          </a-scene>








          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54274334%2faframe-vive-controller-uncaught-typeerror-hand-getattribute-is-not-a-function%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Newest version of d3-selection attribute method is just attr



            var hand = d3.select('.con_left');
            var pos = hand.attr('position');


            Here is an example:






            setInterval(() => {
            const box = d3.select('a-box')
            const sphere = d3.select('a-sphere')
            box.attr('position', `${-Math.random()/5} ${Math.random()/5} -3`)
            sphere.attr('position', `${Math.random()} ${1+Math.random()/5} -5`)
            }, 50);

            <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
            <script src="https://d3js.org/d3.v5.min.js"></script>
            <a-scene>
            <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
            <a-box position="-1 0.5 -3" rotation="0 45 0" width="1" height="1" depth="1" color="#4CC3D9"></a-box>
            <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
            <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
            <a-sky color="#ECECEC"></a-sky>
            </a-scene>








            share|improve this answer






























              0














              Newest version of d3-selection attribute method is just attr



              var hand = d3.select('.con_left');
              var pos = hand.attr('position');


              Here is an example:






              setInterval(() => {
              const box = d3.select('a-box')
              const sphere = d3.select('a-sphere')
              box.attr('position', `${-Math.random()/5} ${Math.random()/5} -3`)
              sphere.attr('position', `${Math.random()} ${1+Math.random()/5} -5`)
              }, 50);

              <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
              <script src="https://d3js.org/d3.v5.min.js"></script>
              <a-scene>
              <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
              <a-box position="-1 0.5 -3" rotation="0 45 0" width="1" height="1" depth="1" color="#4CC3D9"></a-box>
              <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
              <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
              <a-sky color="#ECECEC"></a-sky>
              </a-scene>








              share|improve this answer




























                0












                0








                0







                Newest version of d3-selection attribute method is just attr



                var hand = d3.select('.con_left');
                var pos = hand.attr('position');


                Here is an example:






                setInterval(() => {
                const box = d3.select('a-box')
                const sphere = d3.select('a-sphere')
                box.attr('position', `${-Math.random()/5} ${Math.random()/5} -3`)
                sphere.attr('position', `${Math.random()} ${1+Math.random()/5} -5`)
                }, 50);

                <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
                <script src="https://d3js.org/d3.v5.min.js"></script>
                <a-scene>
                <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
                <a-box position="-1 0.5 -3" rotation="0 45 0" width="1" height="1" depth="1" color="#4CC3D9"></a-box>
                <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
                <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
                <a-sky color="#ECECEC"></a-sky>
                </a-scene>








                share|improve this answer















                Newest version of d3-selection attribute method is just attr



                var hand = d3.select('.con_left');
                var pos = hand.attr('position');


                Here is an example:






                setInterval(() => {
                const box = d3.select('a-box')
                const sphere = d3.select('a-sphere')
                box.attr('position', `${-Math.random()/5} ${Math.random()/5} -3`)
                sphere.attr('position', `${Math.random()} ${1+Math.random()/5} -5`)
                }, 50);

                <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
                <script src="https://d3js.org/d3.v5.min.js"></script>
                <a-scene>
                <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
                <a-box position="-1 0.5 -3" rotation="0 45 0" width="1" height="1" depth="1" color="#4CC3D9"></a-box>
                <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
                <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
                <a-sky color="#ECECEC"></a-sky>
                </a-scene>








                setInterval(() => {
                const box = d3.select('a-box')
                const sphere = d3.select('a-sphere')
                box.attr('position', `${-Math.random()/5} ${Math.random()/5} -3`)
                sphere.attr('position', `${Math.random()} ${1+Math.random()/5} -5`)
                }, 50);

                <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
                <script src="https://d3js.org/d3.v5.min.js"></script>
                <a-scene>
                <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
                <a-box position="-1 0.5 -3" rotation="0 45 0" width="1" height="1" depth="1" color="#4CC3D9"></a-box>
                <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
                <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
                <a-sky color="#ECECEC"></a-sky>
                </a-scene>





                setInterval(() => {
                const box = d3.select('a-box')
                const sphere = d3.select('a-sphere')
                box.attr('position', `${-Math.random()/5} ${Math.random()/5} -3`)
                sphere.attr('position', `${Math.random()} ${1+Math.random()/5} -5`)
                }, 50);

                <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
                <script src="https://d3js.org/d3.v5.min.js"></script>
                <a-scene>
                <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
                <a-box position="-1 0.5 -3" rotation="0 45 0" width="1" height="1" depth="1" color="#4CC3D9"></a-box>
                <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
                <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
                <a-sky color="#ECECEC"></a-sky>
                </a-scene>






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 20 at 9:25

























                answered Jan 20 at 8:30









                cal_br_marcal_br_mar

                66638




                66638
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54274334%2faframe-vive-controller-uncaught-typeerror-hand-getattribute-is-not-a-function%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Liquibase includeAll doesn't find base path

                    How to use setInterval in EJS file?

                    Petrus Granier-Deferre