0
votes

I am loading walls into my scene and applying the static-body physics component from Don McCurdy's aframe-extras script. However, I only two of my walls are behaving as colliders (right wall & right column) and all other walls are physics free. How do I load physics colliders on all walls?

See demo at - https://mannymeadows.github.io/Noosa/. What am I missing?

<html>
<head>
  <script src="https://aframe.io/releases/0.3.2/aframe.min.js"></script>
  <script src="https://mannymeadows.github.io/Noosa/aframe-extras.js" 
  </script>
</head>
<body>
 <a-scene physics>
   <a-assets>
     <img id="sky" src="https://mannymeadows.github.io/Noosa/models/pano-
     test.jpg">
     <a-asset-item id="room-obj" 
     src="https://mannymeadows.github.io/Noosa/models/shop-walls.obj">
     </a-asset-item>
     <a-asset-item id="stool-obj" 
     src="https://mannymeadows.github.io/Noosa/models/riva1920_onelove_obj.obj">  
     </a-asset-item>
     <a-asset-item id="stool-mtl" 
     src="https://mannymeadows.github.io/Noosa/models/riva1920_onelove_obj.mtl">
     </a-asset-item>
   </a-assets>
   <!-- Player -->
   <a-entity camera                
     universal-controls
     look-controls
     kinematic-body
     position="0 1.764 0">
   </a-entity>
   <!-- Floor -->
   <a-plane rotation="-90 0 0" width="54" height="54" color="#e2c5c9" 
   static-body></a-plane>
   <!-- Sky -->
   <a-sky src="#sky"></a-sky>
   <!-- Wall collider -->      
   <a-entity static-body obj-model="obj: #room-obj"></a-entity>
   <!-- furniture -->
   <a-entity static-body scale="0.05 0.05 0.05" rotation="-90 0 0" 
   position="0 0 -5" obj-model="obj: #stool-obj; mtl: #stool-mtl"></a-entity>
 </a-scene>
</body>
</html>

I am able to load simple wall OBJ models with physics applied, but when the walls become slightly more complex, the static-body component won't work.

1

1 Answers

2
votes

what about try to use A-Frame<a-box>or<a-plane>elements to make the wall instead of OBJ models? if you don't need a complex house model. I think your kinematic body impact with OBJ model's bounding box. my code is like:

<a-entity id="house">
  <a-plane width="5"
    id="rightwall"
    height="3"
    position="2.5 1.6 -2.5"
    rotation = "0 90 0"
    material="side:double">
  </a-plane>
  <a-plane width="5"
    id="leftwall"
    height="3"
    position="0 1.6 -5"
    material="side:double">
  </a-plane>
  <a-plane width="5"
    id="backwall"
    height="3"
    position="0 1.6 0"
    material="side:double">
  </a-plane>
</a-entity>