A-Frame static-body on a-entity











up vote
0
down vote

favorite












I am trying out on aframe physics



I can apply static-body properties on a shape object:



<a-sphere color="red" width="2" height="2" depth="2" position="2 1 -5" rotation="45 0 0" static-body></a-sphere>


But not on a a-entity object, i am still able to move through the object:



<a-entity static-body obj-model="obj:models/lamp_mesh.obj;mtl:images/lamp_mesh.mtl" rotation="0 90 0" position="5.46 0 0" animation></a-entity>


Is it only possible to apply the static/dynamic properties on a shape object?



Or i have done something wrong somewhere



I seen many tutorials of physics on shape object but none on a-entity object.



Please advice.
Thanks in advance.










share|improve this question




























    up vote
    0
    down vote

    favorite












    I am trying out on aframe physics



    I can apply static-body properties on a shape object:



    <a-sphere color="red" width="2" height="2" depth="2" position="2 1 -5" rotation="45 0 0" static-body></a-sphere>


    But not on a a-entity object, i am still able to move through the object:



    <a-entity static-body obj-model="obj:models/lamp_mesh.obj;mtl:images/lamp_mesh.mtl" rotation="0 90 0" position="5.46 0 0" animation></a-entity>


    Is it only possible to apply the static/dynamic properties on a shape object?



    Or i have done something wrong somewhere



    I seen many tutorials of physics on shape object but none on a-entity object.



    Please advice.
    Thanks in advance.










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am trying out on aframe physics



      I can apply static-body properties on a shape object:



      <a-sphere color="red" width="2" height="2" depth="2" position="2 1 -5" rotation="45 0 0" static-body></a-sphere>


      But not on a a-entity object, i am still able to move through the object:



      <a-entity static-body obj-model="obj:models/lamp_mesh.obj;mtl:images/lamp_mesh.mtl" rotation="0 90 0" position="5.46 0 0" animation></a-entity>


      Is it only possible to apply the static/dynamic properties on a shape object?



      Or i have done something wrong somewhere



      I seen many tutorials of physics on shape object but none on a-entity object.



      Please advice.
      Thanks in advance.










      share|improve this question















      I am trying out on aframe physics



      I can apply static-body properties on a shape object:



      <a-sphere color="red" width="2" height="2" depth="2" position="2 1 -5" rotation="45 0 0" static-body></a-sphere>


      But not on a a-entity object, i am still able to move through the object:



      <a-entity static-body obj-model="obj:models/lamp_mesh.obj;mtl:images/lamp_mesh.mtl" rotation="0 90 0" position="5.46 0 0" animation></a-entity>


      Is it only possible to apply the static/dynamic properties on a shape object?



      Or i have done something wrong somewhere



      I seen many tutorials of physics on shape object but none on a-entity object.



      Please advice.
      Thanks in advance.







      html aframe






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 at 10:24

























      asked Nov 10 at 8:07









      TYC

      7618




      7618
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          There should be no issues with using static-body with any <a-entity> elements.
          Here you have a link, where i use it with a <a-entity> with a gltf model.





          There is a useful flag debug: true for the physics component:



          <a-scene physics="debug: true">


          If you don't see a wireframe around your object, then its possible there is no physics body attached to it.





          Make sure your model is loaded properly, check the wireframe around it, if there is none, you can:



          1) Convert your .obj model to the web standard .gltf (official converter here)

          2) Create the physics bodies manually. From the docs:



          <a-entity gltf-model="src: mug.glb"
          body="type: dynamic; mass: 5; shape: none;"
          shape__main="shape: cylinder;
          height: 0.36;
          radiusTop: 0.24;
          radiusBottom: 0.24;"
          shape__handle="shape: box;
          halfExtents: 0.15 0.18 0.04;
          offset: 0.4 0 0;">
          </a-entity>





          share|improve this answer























          • the example in your link, camera still seems to be able to go through both gltf-model and the a-entity, i am guessing that the camera need to have something like a static-body properties?
            – TYC
            Nov 11 at 11:45












          • The spheres should bounce off the head models aframe-model-physics.glitch.me. I've added a listener for model-loaded, so they won't fall until the heads are present. I didn't attach any kind of body to the camera.
            – Piotr Adam Milewski
            Nov 11 at 11:52












          • is it possible to make the camera unable to "go through" either the sphere or the head?
            – TYC
            Nov 11 at 11:56












          • oh yes, i was missing out the kinematic-body properties. Thanks for the help again
            – TYC
            Nov 11 at 12:10












          • It was simple with previous versions of aframe-extras and aframe-physics, check out this anwser, yet preventing the camera from moving through obstacles is not in the creators intention (since aframe is created for VR). If you attach a static body, to the camera, all dynamic bodies will bounce off, but you will still move through other static bodies. The easiest way to bounce off the camera accelerating it a bit in the opposite direction than the wall.
            – Piotr Adam Milewski
            Nov 11 at 12:12











          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',
          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%2f53237145%2fa-frame-static-body-on-a-entity%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          There should be no issues with using static-body with any <a-entity> elements.
          Here you have a link, where i use it with a <a-entity> with a gltf model.





          There is a useful flag debug: true for the physics component:



          <a-scene physics="debug: true">


          If you don't see a wireframe around your object, then its possible there is no physics body attached to it.





          Make sure your model is loaded properly, check the wireframe around it, if there is none, you can:



          1) Convert your .obj model to the web standard .gltf (official converter here)

          2) Create the physics bodies manually. From the docs:



          <a-entity gltf-model="src: mug.glb"
          body="type: dynamic; mass: 5; shape: none;"
          shape__main="shape: cylinder;
          height: 0.36;
          radiusTop: 0.24;
          radiusBottom: 0.24;"
          shape__handle="shape: box;
          halfExtents: 0.15 0.18 0.04;
          offset: 0.4 0 0;">
          </a-entity>





          share|improve this answer























          • the example in your link, camera still seems to be able to go through both gltf-model and the a-entity, i am guessing that the camera need to have something like a static-body properties?
            – TYC
            Nov 11 at 11:45












          • The spheres should bounce off the head models aframe-model-physics.glitch.me. I've added a listener for model-loaded, so they won't fall until the heads are present. I didn't attach any kind of body to the camera.
            – Piotr Adam Milewski
            Nov 11 at 11:52












          • is it possible to make the camera unable to "go through" either the sphere or the head?
            – TYC
            Nov 11 at 11:56












          • oh yes, i was missing out the kinematic-body properties. Thanks for the help again
            – TYC
            Nov 11 at 12:10












          • It was simple with previous versions of aframe-extras and aframe-physics, check out this anwser, yet preventing the camera from moving through obstacles is not in the creators intention (since aframe is created for VR). If you attach a static body, to the camera, all dynamic bodies will bounce off, but you will still move through other static bodies. The easiest way to bounce off the camera accelerating it a bit in the opposite direction than the wall.
            – Piotr Adam Milewski
            Nov 11 at 12:12















          up vote
          1
          down vote



          accepted










          There should be no issues with using static-body with any <a-entity> elements.
          Here you have a link, where i use it with a <a-entity> with a gltf model.





          There is a useful flag debug: true for the physics component:



          <a-scene physics="debug: true">


          If you don't see a wireframe around your object, then its possible there is no physics body attached to it.





          Make sure your model is loaded properly, check the wireframe around it, if there is none, you can:



          1) Convert your .obj model to the web standard .gltf (official converter here)

          2) Create the physics bodies manually. From the docs:



          <a-entity gltf-model="src: mug.glb"
          body="type: dynamic; mass: 5; shape: none;"
          shape__main="shape: cylinder;
          height: 0.36;
          radiusTop: 0.24;
          radiusBottom: 0.24;"
          shape__handle="shape: box;
          halfExtents: 0.15 0.18 0.04;
          offset: 0.4 0 0;">
          </a-entity>





          share|improve this answer























          • the example in your link, camera still seems to be able to go through both gltf-model and the a-entity, i am guessing that the camera need to have something like a static-body properties?
            – TYC
            Nov 11 at 11:45












          • The spheres should bounce off the head models aframe-model-physics.glitch.me. I've added a listener for model-loaded, so they won't fall until the heads are present. I didn't attach any kind of body to the camera.
            – Piotr Adam Milewski
            Nov 11 at 11:52












          • is it possible to make the camera unable to "go through" either the sphere or the head?
            – TYC
            Nov 11 at 11:56












          • oh yes, i was missing out the kinematic-body properties. Thanks for the help again
            – TYC
            Nov 11 at 12:10












          • It was simple with previous versions of aframe-extras and aframe-physics, check out this anwser, yet preventing the camera from moving through obstacles is not in the creators intention (since aframe is created for VR). If you attach a static body, to the camera, all dynamic bodies will bounce off, but you will still move through other static bodies. The easiest way to bounce off the camera accelerating it a bit in the opposite direction than the wall.
            – Piotr Adam Milewski
            Nov 11 at 12:12













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          There should be no issues with using static-body with any <a-entity> elements.
          Here you have a link, where i use it with a <a-entity> with a gltf model.





          There is a useful flag debug: true for the physics component:



          <a-scene physics="debug: true">


          If you don't see a wireframe around your object, then its possible there is no physics body attached to it.





          Make sure your model is loaded properly, check the wireframe around it, if there is none, you can:



          1) Convert your .obj model to the web standard .gltf (official converter here)

          2) Create the physics bodies manually. From the docs:



          <a-entity gltf-model="src: mug.glb"
          body="type: dynamic; mass: 5; shape: none;"
          shape__main="shape: cylinder;
          height: 0.36;
          radiusTop: 0.24;
          radiusBottom: 0.24;"
          shape__handle="shape: box;
          halfExtents: 0.15 0.18 0.04;
          offset: 0.4 0 0;">
          </a-entity>





          share|improve this answer














          There should be no issues with using static-body with any <a-entity> elements.
          Here you have a link, where i use it with a <a-entity> with a gltf model.





          There is a useful flag debug: true for the physics component:



          <a-scene physics="debug: true">


          If you don't see a wireframe around your object, then its possible there is no physics body attached to it.





          Make sure your model is loaded properly, check the wireframe around it, if there is none, you can:



          1) Convert your .obj model to the web standard .gltf (official converter here)

          2) Create the physics bodies manually. From the docs:



          <a-entity gltf-model="src: mug.glb"
          body="type: dynamic; mass: 5; shape: none;"
          shape__main="shape: cylinder;
          height: 0.36;
          radiusTop: 0.24;
          radiusBottom: 0.24;"
          shape__handle="shape: box;
          halfExtents: 0.15 0.18 0.04;
          offset: 0.4 0 0;">
          </a-entity>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 11 at 8:03

























          answered Nov 10 at 13:40









          Piotr Adam Milewski

          4,89721025




          4,89721025












          • the example in your link, camera still seems to be able to go through both gltf-model and the a-entity, i am guessing that the camera need to have something like a static-body properties?
            – TYC
            Nov 11 at 11:45












          • The spheres should bounce off the head models aframe-model-physics.glitch.me. I've added a listener for model-loaded, so they won't fall until the heads are present. I didn't attach any kind of body to the camera.
            – Piotr Adam Milewski
            Nov 11 at 11:52












          • is it possible to make the camera unable to "go through" either the sphere or the head?
            – TYC
            Nov 11 at 11:56












          • oh yes, i was missing out the kinematic-body properties. Thanks for the help again
            – TYC
            Nov 11 at 12:10












          • It was simple with previous versions of aframe-extras and aframe-physics, check out this anwser, yet preventing the camera from moving through obstacles is not in the creators intention (since aframe is created for VR). If you attach a static body, to the camera, all dynamic bodies will bounce off, but you will still move through other static bodies. The easiest way to bounce off the camera accelerating it a bit in the opposite direction than the wall.
            – Piotr Adam Milewski
            Nov 11 at 12:12


















          • the example in your link, camera still seems to be able to go through both gltf-model and the a-entity, i am guessing that the camera need to have something like a static-body properties?
            – TYC
            Nov 11 at 11:45












          • The spheres should bounce off the head models aframe-model-physics.glitch.me. I've added a listener for model-loaded, so they won't fall until the heads are present. I didn't attach any kind of body to the camera.
            – Piotr Adam Milewski
            Nov 11 at 11:52












          • is it possible to make the camera unable to "go through" either the sphere or the head?
            – TYC
            Nov 11 at 11:56












          • oh yes, i was missing out the kinematic-body properties. Thanks for the help again
            – TYC
            Nov 11 at 12:10












          • It was simple with previous versions of aframe-extras and aframe-physics, check out this anwser, yet preventing the camera from moving through obstacles is not in the creators intention (since aframe is created for VR). If you attach a static body, to the camera, all dynamic bodies will bounce off, but you will still move through other static bodies. The easiest way to bounce off the camera accelerating it a bit in the opposite direction than the wall.
            – Piotr Adam Milewski
            Nov 11 at 12:12
















          the example in your link, camera still seems to be able to go through both gltf-model and the a-entity, i am guessing that the camera need to have something like a static-body properties?
          – TYC
          Nov 11 at 11:45






          the example in your link, camera still seems to be able to go through both gltf-model and the a-entity, i am guessing that the camera need to have something like a static-body properties?
          – TYC
          Nov 11 at 11:45














          The spheres should bounce off the head models aframe-model-physics.glitch.me. I've added a listener for model-loaded, so they won't fall until the heads are present. I didn't attach any kind of body to the camera.
          – Piotr Adam Milewski
          Nov 11 at 11:52






          The spheres should bounce off the head models aframe-model-physics.glitch.me. I've added a listener for model-loaded, so they won't fall until the heads are present. I didn't attach any kind of body to the camera.
          – Piotr Adam Milewski
          Nov 11 at 11:52














          is it possible to make the camera unable to "go through" either the sphere or the head?
          – TYC
          Nov 11 at 11:56






          is it possible to make the camera unable to "go through" either the sphere or the head?
          – TYC
          Nov 11 at 11:56














          oh yes, i was missing out the kinematic-body properties. Thanks for the help again
          – TYC
          Nov 11 at 12:10






          oh yes, i was missing out the kinematic-body properties. Thanks for the help again
          – TYC
          Nov 11 at 12:10














          It was simple with previous versions of aframe-extras and aframe-physics, check out this anwser, yet preventing the camera from moving through obstacles is not in the creators intention (since aframe is created for VR). If you attach a static body, to the camera, all dynamic bodies will bounce off, but you will still move through other static bodies. The easiest way to bounce off the camera accelerating it a bit in the opposite direction than the wall.
          – Piotr Adam Milewski
          Nov 11 at 12:12




          It was simple with previous versions of aframe-extras and aframe-physics, check out this anwser, yet preventing the camera from moving through obstacles is not in the creators intention (since aframe is created for VR). If you attach a static body, to the camera, all dynamic bodies will bounce off, but you will still move through other static bodies. The easiest way to bounce off the camera accelerating it a bit in the opposite direction than the wall.
          – Piotr Adam Milewski
          Nov 11 at 12:12


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237145%2fa-frame-static-body-on-a-entity%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          Popular posts from this blog

          Full-time equivalent

          Bicuculline

          さくらももこ